Question by
TiToMoskito · Jun 20, 2021 at 07:15 PM ·
xmlil2cppmonoxmlserializer
Reading XML on Mono Fails - IL2CPP works?!
Hi,
my game needs to read a xml file, and on IL2CPP and Editor it works without any issues. But when i built it in Mono, i got this stupid errors:
System.MissingMethodException: Default constructor not found for type System.Diagnostics.SystemDiagnosticsSection
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <f3b441e34e334f86b90d32f3b50d01cd>:0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <f3b441e34e334f86b90d32f3b50d01cd>:0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <f3b441e34e334f86b90d32f3b50d01cd>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x0002c] in <f3b441e34e334f86b90d32f3b50d01cd>:0
at System.Configuration.ConfigInfo.CreateInstance () [0x00026] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
at System.Configuration.SectionInfo.CreateInstance () [0x00000] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, System.Boolean createDefaultInstance) [0x0001c] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x0002c] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
at System.Configuration.Configuration.GetSection (System.String sectionName) [0x0001e] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00006] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00005] in <009ae07fc98f4cf182f2f0676c4c5dd9>:0
at System.Configuration.PrivilegedConfigurationManager.GetSection (System.String sectionName) [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection () [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Diagnostics.DiagnosticsConfiguration.Initialize () [0x0002a] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Diagnostics.DiagnosticsConfiguration.get_SwitchSettings () [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Diagnostics.Switch.InitializeConfigSettings () [0x00013] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Diagnostics.Switch.InitializeWithStatus () [0x00046] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Diagnostics.Switch.get_SwitchSetting () [0x0000a] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Diagnostics.BooleanSwitch.get_Enabled () [0x00000] in <5ebb2774be7b4e249853ef7dd3b06add>:0
at System.Xml.Serialization.TempAssembly.LoadGeneratedAssembly (System.Type type, System.String defaultNamespace, System.Xml.Serialization.XmlSerializerImplementation& contract) [0x0001a] in <bab9525fff6b49829c609a2865c9287a>:0
at System.Xml.Serialization.XmlSerializer..ctor (System.Type type, System.String defaultNamespace) [0x0007e] in <bab9525fff6b49829c609a2865c9287a>:0
at System.Xml.Serialization.XmlSerializer..ctor (System.Type type) [0x00000] in <bab9525fff6b49829c609a2865c9287a>:0
at BeardedMonkeys.Utils.XmlDeserializeFile[T] (System.String serializedObject) [0x00001] in E:\Projekte\Unity\RaceProject\Assets\Scripts\Utility\Utils.cs:366
at BeardedMonkeys.MapManager.Initialize () [0x000c0] in E:\Projekte\Unity\RaceProject\Assets\Scripts\Map\MapManager.cs:57
CreateInstanceMono(:0)
How do i fix this? (It worked a few days ago...
Comment
It seems like someone has a same issue: https://issuetracker.unity3d.com/issues/class-get-stripped-when-using-preserve-attribute-with-mono-backend