Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

Resolved Loading XML in Mono Build fails, IL2CPP + Editor work

Discussion in 'Editor & General Support' started by TiToMoskito, Jun 20, 2021.

  1. TiToMoskito


    Jan 28, 2014

    i have an strange issue, if i build my project in mono, i can't load an xml file which worked two days ago.
    Than i built it with IL2CPP and i can load there the XML file. I also removed the Library folder.

    Im getting this error:
    Code (CSharp):
    1. System.MissingMethodException: Default constructor not found for type System.Diagnostics.SystemDiagnosticsSection
    2.   at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <f3b441e34e334f86b90d32f3b50d01cd>:0
    3.   at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <f3b441e34e334f86b90d32f3b50d01cd>:0
    4.   at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <f3b441e34e334f86b90d32f3b50d01cd>:0
    5.   at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x0002c] in <f3b441e34e334f86b90d32f3b50d01cd>:0
    6.   at System.Configuration.ConfigInfo.CreateInstance () [0x00026] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
    7.   at System.Configuration.SectionInfo.CreateInstance () [0x00000] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
    8.   at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, System.Boolean createDefaultInstance) [0x0001c] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
    9.   at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x0002c] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
    10.   at System.Configuration.Configuration.GetSection (System.String sectionName) [0x0001e] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
    11.   at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00006] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
    12.   at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00005] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
    13.   at System.Configuration.PrivilegedConfigurationManager.GetSection (System.String sectionName) [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    14.   at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection () [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    15.   at System.Diagnostics.DiagnosticsConfiguration.Initialize () [0x0002a] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    16.   at System.Diagnostics.DiagnosticsConfiguration.get_SwitchSettings () [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    17.   at System.Diagnostics.Switch.InitializeConfigSettings () [0x00013] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    18.   at System.Diagnostics.Switch.InitializeWithStatus () [0x00046] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    19.   at System.Diagnostics.Switch.get_SwitchSetting () [0x0000a] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    20.   at System.Diagnostics.BooleanSwitch.get_Enabled () [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
    21.   at System.Xml.Serialization.TempAssembly.LoadGeneratedAssembly (System.Type type, System.String defaultNamespace, System.Xml.Serialization.XmlSerializerImplementation& contract) [0x0001a] in <bab9525fff6b49829c609a2865c9287a>:0
    22.   at System.Xml.Serialization.XmlSerializer..ctor (System.Type type, System.String defaultNamespace) [0x0007e] in <bab9525fff6b49829c609a2865c9287a>:0
    23.   at System.Xml.Serialization.XmlSerializer..ctor (System.Type type) [0x00000] in <bab9525fff6b49829c609a2865c9287a>:0
    24.   at BeardedMonkeys.Utils.XmlDeserializeFile[T] (System.String serializedObject) [0x00001] in E:\Projekte\Unity\RaceProject\Assets\Scripts\Utility\Utils.cs:361
    25.   at BeardedMonkeys.MapManager.Initialize () [0x000a3] in E:\Projekte\Unity\RaceProject\Assets\Scripts\Map\MapManager.cs:52
    27. CreateInstanceMono(:0)
    I can also load the XML file in the Editor Window. I dont know what changed a few days ago...

    It seems that someone has a same issue:
    Last edited: Jun 20, 2021
  2. Kurt-Dekker


    Mar 16, 2013
    Potentially it is code stripping happening at the IL2CPP link stage. Put a constructor for
    somewhere in your code and see if the error changes when you run that code.
  3. TiToMoskito


    Jan 28, 2014
    Yes code stripping was the problem, i disabled it and now i can build again in mono. Thank you.
    Kurt-Dekker likes this.