Search Issue Tracker

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.

Postponed

Votes

3

Found in

5.2.0f3

Issue ID

726371

Regression

No

IL2CPP crashes when using SmtpClient

IL2CPP

-

How to reproduce:

1. Open a new project
2. Import the attached script (SendMail.cs)
3. In the Player Settings set the Api Compatibility Level to .Net 2.0
4. Build to iOS and run
- Note the error thrown:
MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.Net.Configuration.MailSettingsSectionGroup'.

Comments (10)

  1. shubhamswaraj2021

    Aug 22, 2020 10:49

    good one <a href="https://www.lyricsauto.com">lyricsauto</a>

  2. unnanego

    Oct 17, 2018 11:49

    Link worked for me with 2018.2.11 and iOS 12. Had a problem with an invisible symbol appearing when copying from the forum post regarding the issue and having to add the fourth line - paste pay attention to this if link is not helping.

  3. dorukeker

    Apr 20, 2018 12:06

    The workaround with link.xml worked.
    file content:

    <linker>
    <assembly fullname="System">
    <type fullname="System.Net.Configuration.MailSettingsSectionGroup" preserve="all"/>
    <type fullname="System.Net.Configuration.SmtpSection" preserve="all"/>
    <type fullname="System.Net.Configuration.SmtpNetworkElement" preserve="all"/>
    <type fullname="System.Net.Configuration.SmtpSpecifiedPickupDirect‌oryElement" preserve="all"/>
    </assembly>
    </linker>

    Also added the below to my script.
    using System.Net.Configuration

  4. awardell

    Jan 26, 2018 03:22

    This is still an issue, and the link.xml file workaround no longer works. Instead, I had to use the solution here: https://fogbugz.unity3d.com/default.asp?837009_jo48ot1ti6mbc4a4 as well as create a dummy method for forcing the default constructors to be included:

    public void Includes()
    {
    var incl0 = new System.Net.Configuration.MailSettingsSectionGroup();
    var incl1 = new System.Net.Configuration.SmtpSection();
    var incl2 = new System.Net.Configuration.SmtpNetworkElement();
    }

    Is Unity Technologies ever going to address this issue?

  5. garrahan

    Nov 23, 2017 17:27

    OK the link.xml solution did seem work for WebGL

    Set api level to .Net 2.0

    Make a "link.xml" and place in your assets folder.

    <linker>
    <assembly fullname="System">
    <type fullname="System.Net.Configuration.MailSettingsSectionGroup" preserve="all"/>
    <type fullname="System.Net.Configuration.SmtpSection" preserve="all"/>
    <type fullname="System.Net.Configuration.SmtpNetworkElement" preserve="all"/>
    </assembly>
    </linker>

  6. garrahan

    Nov 23, 2017 17:17

    Still having the issue with in WebGL. 5.6.2f1 Says the 'Default constructor not found...ctor() of System.Net.Configuration.MailSettingsSectionGroup'.

    I did try the link.xml solution but still not work.

  7. Protozoaire

    Mar 20, 2017 08:19

    Like Friflo, spent a day before getting to this Unity issue workaround. Nov 20, 2015? Bug still present on Unity 5.5.0f3 Mar 20, 2017.

  8. fmathews34

    Jul 14, 2016 17:29

    was this resolved? because i am getting the same issue in my webGL build

  9. friflo

    Jan 24, 2016 21:35

    Had same issue. A similiar exception text is "Failed to fast create instance for type ..."
    when using Activator.CreateInstance().
    Spend some hours before getting to this issue report :)
    btw: using link.xml is really only a workaround.

  10. JoshPeterson

    Nov 20, 2015 12:36

    Note that it is possible to work around this bug by using the following link.xml file:

    <linker>
    <assembly fullname="System">
    <type fullname="System.Net.Configuration.MailSettingsSectionGroup" preserve="all"/>
    <type fullname="System.Net.Configuration.SmtpSection" preserve="all"/>
    <type fullname="System.Net.Configuration.SmtpNetworkElement" preserve="all"/>
    </assembly>
    </linker>

    More details about the link.xml file are available here: http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html

    Once this bug is corrected, this link.xml file will not be necessary.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.