Search Issue Tracker
By Design
Votes
13
Found in
Issue ID
1034782
Regression
No
System.Configuration.ConfigurationErrorsException: Failed to load configuration section for dataContractSerializer
Using works fine in editor, but on device (iOS / Android) we are getting the error below. Looks like others have encountered this (https://forum.unity.com/threads/uwp-datacontractserializer-fails-to-load-configuration-section.507801/)
The Error:
[WARNING] System.Configuration.ConfigurationErrorsException: Failed to load configuration section for dataContractSerializer.
at System.Runtime.Serialization.Configuration.DataContractSerializerSection.UnsafeGetSection () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.DataContract.get_ConfigSection () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.DataContract.LoadKnownTypesFromConfig (System.Type type, System.Collections.Generic.Dictionary`2[TKey,TValue] typesChecked, System.Collections.Generic.Dictionary`2[System.Xml.XmlQualifiedName,System.Runtime.Serialization.DataContract]& knownDataContracts) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes (System.Type type, System.Collections.Generic.Dictionary`2[TKey,TValue] typesChecked, System.Collections.Generic.Dictionary`2[System.Xml.XmlQualifiedName,System.Runtime.Serialization.DataContract]& knownDataContracts) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.ClassDataContract+ClassDataContractCriticalHelper.get_KnownDataContracts () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType (System.Runtime.Serialization.DataContract dataContract, System.Runtime.Serialization.XmlWriterDelegator xmlWriter, System.Object obj, System.RuntimeTypeHandle declaredTypeHandle) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalWriteObjectContent (System.Runtime.Serialization.XmlWriterDelegator writer, System.Object graph) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalWriteObject (System.Runtime.Serialization.XmlWriterDelegator writer, System.Object graph) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions (System.Runtime.Serialization.XmlWriterDelegator writer, System.Object graph, System.Runtime.Serialization.DataContractResolver dataContractResolver) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.WriteObject (System.IO.Stream stream, System.Object graph) [0x00000] in <00000000000000000000000000000000>:0
at WBG.Common.Request.WBGRequest.SerializeType[T] (T data) [0x00000] in <00000000000000000000000000000000>:0
at WBG.Common.Request.WBGRequest.Send[SendType,RespType] (System.String url, WBG.Common.Request.WBGRequest+Verb verb, System.Collections.Generic.Dictionary`2[TKey,TValue] headers, SendType data) [0x00000] in <00000000000000000000000000000000>:0
at Iridium.IR_Request.SendRequest[SendType,RespType] (System.String url, WBG.Common.Request.WBGRequest+Verb verb, SendType data) [0x00000] in <00000000000000000000000000000000>:0
at IridiumSDK.SendRequest[SendType,RespType] (System.String url, WBG.Common.Request.WBGRequest+Verb verb, SendType data) [0x00000] in <00000000000000000000000000000000>:0
at IridiumEATService.GetActionTimerEntities (System.String playerId) [0x00000] in <00000000000000000000000000000000>:0
at DreadAPI.DN_EAT.GetActionTimerEntities (System.String playerId) [0x00000] in <00000000000000000000000000000000>:0
at ActionTimerEntityManager.RefreshActionTimersData (WBG.Common.Callbacks+AsynchronousCallbackType callback) [0x00000] in <00000000000000000000000000000000>:0
at WBG.Common.WBGAsync._Next (System.String error, System.Object retval) [0x00000] in <00000000000000000000000000000000>:0
at WBG.Assets.HttpAssetBundleLoader+<DownloadAssetBundleWithCoroutine>c__Iterator0.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
WBG.Logging.Internal.UnityConsoleDescriptor:Write(StringBuilder)
WBG.Logging.Internal.LogManager:WriteToDescriptors(StringBuilder)
IridiumEATService:GetActionTimerEntities(String)
DreadAPI.DN_EAT:GetActionTimerEntities(String)
ActionTimerEntityManager:RefreshActionTimersData(AsynchronousCallbackType)
WBG.Common.WBGAsync:_Next(String, Object)
WBG.Assets.<DownloadAssetBundleWithCoroutine>c__Iterator0:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
-
mayasarii876
Mar 08, 2022 08:21
http://103.56.148.201/
http://103.56.148.201/newmpo
http://103.56.148.201/mpo17
http://103.56.148.201/mpomm
http://103.56.148.201/mpotower
http://103.56.148.201/parisklub
http://103.56.148.201/juraganslot
http://103.56.148.201/mpo500
http://103.56.148.201/mpokick
http://103.56.148.201/mpoyes
http://103.56.148.201/xyzklub
http://103.56.148.201/betmpo
http://103.56.148.201/ogslot88
http://103.56.148.201/hoki777
http://103.56.148.201/mpojuta
http://103.56.148.201/299slot
http://103.56.148.201/mpo188
http://103.56.148.201/mpogacor
http://103.56.148.201/mpo300
http://103.56.148.201/rgo365
http://103.56.148.201/kingdom288
http://103.56.148.201/wigompo
http://103.56.148.201/mpo8899
http://103.56.148.201/mpopelangi
http://103.56.148.201/mpo555
http://103.56.148.201/dutampo
http://103.56.148.201/klik368
http://103.56.148.201/388hero
http://103.56.148.201/19dewa
http://103.56.148.201/mpoxl
http://103.56.148.201/mpoas
http://103.56.148.201/mposun
http://103.56.148.201/qqslot
http://103.56.148.201/mposport
http://103.56.148.201/dewa234
http://103.56.148.201/mesinmpo -
jleemans
Sep 15, 2021 15:55
Hi, I still have this issue with Unity 2020.3.16f1 with XmlSerializer
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.Serialization.XmlFormatWriterInterpreter.TryWritePrimitive (System.Type type, System.Func`1[TResult] value, System.Reflection.MemberInfo memberInfo, System.Nullable`1[T] arrayItemIndex, System.Xml.XmlDictionaryString ns, System.Xml.XmlDictionaryString name, System.Int32 nameIndex) [0x00000] in <00000000000000000000000000000000>:0 -
andycan
May 31, 2019 10:31
problem still persists in version 2019.1.1f1,
when scripting mono backend, on ILCPP it works!! -
FunRobDev
Apr 16, 2019 22:17
Please reopen this issue!.
It is still not working in Unity 2019.1.0f2
with Api Compatibility Level = .NET 4x
I am using the mentioned link.xml -
msawayda
Feb 09, 2019 02:53
I am having the same issue. I have a Wcf method that returns a [DataContract]. My unity project is making a call to the Wcf endpoint and getting the [DataContract] object back. This works fine in the Unity Editor but throws an error with "FAILED TO LOAD CONFIGURATION SECTION FOR DATACONTRACTSERIALIZER" when I run it on a mobile device(in my case android).
I have upgraded Unity to 2018.3.4f1 because Josh Peterson(https://forum.unity.com/members/joshpeterson.660077/) said it was fixed in Unity 2018.3.
I have also added the link.xml file to my Assets folder and switched my android Api Compatibility Level to .NET 4.x.
What version of Unity is this fixed in? Or are there any workarounds to getting this to work?
-
HambaliJ
Nov 29, 2018 05:16
@JOSHPETERSON The issue still persist in 2018.3.0b9. Can you provide me the exact version of 2018.3 you're mentioning.
-
HambaliJ
Nov 16, 2018 08:36
The error still persist in 2018.3.0b9.
Android build also affected
-
JoshPeterson
Sep 04, 2018 11:54
I've seen two different errors in this case, based on the Api Compatibility Level setting.
If the Api Compatibility Level for the project is .NET 4.x, the error originally reported in this thread will occur.
If the Api Compatibility Level for the project is .NET Standard 2.0, I see an exception that starts like this:
NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.Serialization.Json.JsonFormatWriterInterpreter.TryWritePrimitive (System.Type type, System.Func`1[TResult] value, System.Reflection.MemberInfo memberInfo, System.Nullable`1[T] arrayItemIndex, System.Xml.XmlDictionaryString name, System.Int32 nameIndex) [0x00000] in <00000000000000000000000000000000>:0If you are using Unity 2018.2 or newer, you can work around this issue by doing the following:
1. Choose the .NET Standard 2.0 Api Compatibility Level
2. Add a link.xml file to the Assets folder of your project with the following contents:<linker>
<assembly fullname="System.Runtime.Serialization" preserve="all"/>
</linker>The problem here is that the DataContractJsonSerializer implementation in the class library assembly System.Runtime.Serialization.dll uses reflection to access some methods. The Unity managed code linker strips away these methods, and the DataContractJsonSerializer class fails to work properly. By preserving everything in System.Runtime.Serialization.dll, those methods are kept.
Note that this is a different problem with the .NET 4.x Api Compatibility Level. That one is a little more involved. We've corrected it in 2018.3, which should be public beta soon. Prior to that release, you will need to use the .NET Standard 2.0 Api Compatibility Level to work around this issue. Once 2018.3 is available, the link.xml file provided here will still be necessary to make this work properly with either Api Compatibility Level option.
-
CatherineIrkalla
Aug 27, 2018 01:07
Can confirm same issue on UWP.
-
Mgravitus
Aug 06, 2018 02:07
Same issue on uwp. Any work arounds?
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android][URP][OpenGLES3] Render Texture memory increases by 50% when using OpenGLES 3
- MouseButton(0) loses click state when using Device Simulator and enabling "Any iOS Device" in Unity Remote
- [Linux] "Sending message header failed (11)" Warning in Console when opening or closing Standalone Profiler
- [Backport] MacOS Targetsupport Installers for Linux overwrite their content
- [Backport] Scheduled items, asynchronous tasks, and Update() are not run when EditorWindow is opened using ShowModalUtility()
Resolution Note:
Thanks for submitting this issue. I don't think this is a problem on the Unity side, as we do have a good work around for this issue. I've updated the forum thread with details, and I'll include the same details here:
I've seen two different errors in this case, based on the Api Compatibility Level setting.
If the Api Compatibility Level for the project is .NET 4.x, the error originally reported in this thread will occur.
If the Api Compatibility Level for the project is .NET Standard 2.0, I see an exception that starts like this:
NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.Serialization.Json.JsonFormatWriterInterpreter.TryWritePrimitive (System.Type type, System.Func`1[TResult] value, System.Reflection.MemberInfo memberInfo, System.Nullable`1[T] arrayItemIndex, System.Xml.XmlDictionaryString name, System.Int32 nameIndex) [0x00000] in <00000000000000000000000000000000>:0
If you are using Unity 2018.2 or newer, you can work around this issue by doing the following:
1. Choose the .NET Standard 2.0 Api Compatibility Level
2. Add a link.xml file to the Assets folder of your project with the following contents:
<linker>
<assembly fullname="System.Runtime.Serialization" preserve="all"/>
</linker>
The problem here is that the DataContractJsonSerializer implementation in the class library assembly System.Runtime.Serialization.dll uses reflection to access some methods. The Unity managed code linker strips away these methods, and the DataContractJsonSerializer class fails to work properly. By preserving everything in System.Runtime.Serialization.dll, those methods are kept.
Note that this is a different problem with the .NET 4.x Api Compatibility Level. That one is a little more involved. We've corrected it in 2018.3, which should be public beta soon. Prior to that release, you will need to use the .NET Standard 2.0 Api Compatibility Level to work around this issue. Once 2018.3 is available, the link.xml file provided here will still be necessary to make this work properly with either Api Compatibility Level option.