Invalid IL Code in Build

Hiya,

I’ve been looking for a while now and I can’t seem to get a way to fix my problem. I’ve been trying to use external DLLs with my application and they don’t seem to be working when I’m building my project.

These DLLs allow me to communicate with external systems. The thing is that they are used in my program and they work very well in the editor (communication is sending and receiving properly).
When trying to build my project, I’ve been getting Exceptions while playing (my connection client wouldn’t connect because the method used was not supported). The first ones concerned the Api Compatibility Level and Scripting Backend that I’ve now set to “.Net 4.0” and "Mono".

After that, the error changed to “NotSupportedException: Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled”. Coming across this answer, Ive added the “I18N.dll” and “I18N.West.dll” because the problem seemed to be the same (dll working in editor but not in build".

Now, the error I’m getting is InvalidProgramException: Invalid IL code in I18N.Common.Manager:get_PrimaryManager (): IL_0000: ret.

I’m stuck here because i don’t know where to go anymore. If anyone has a lead, I’m really interested !


Stack Trace :

InvalidProgramException: Invalid IL code in I18N.Common.Manager:get_PrimaryManager (): IL_0000: ret       


  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <437ba245d8404784b9fbab9b439ac908>:0 
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <437ba245d8404784b9fbab9b439ac908>:0 
  at System.RuntimeType.InvokeMember (System.String name, System.Reflection.BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParams) [0x00680] in <437ba245d8404784b9fbab9b439ac908>:0 
  at System.Text.EncodingHelper.InvokeI18N (System.String name, System.Object[] args) [0x0009a] in <437ba245d8404784b9fbab9b439ac908>:0 
  at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0020d] in <437ba245d8404784b9fbab9b439ac908>:0 
  at TwinCAT.Ads.Internal.SymbolUploadInfo.get_StringEncoding () [0x00008] in <367ea3bea40c4a39b8dbbc84cd441231>:0 
  at TwinCAT.Ads.TcAdsSymbolInfoLoader.onUploadSymbols () [0x00158] in <367ea3bea40c4a39b8dbbc84cd441231>:0 
  at TwinCAT.Ads.TcAdsSymbolInfoLoader.initializeUploadSymbols (System.Boolean forceReload) [0x00020] in <367ea3bea40c4a39b8dbbc84cd441231>:0 
  at TwinCAT.Ads.TcAdsSymbolInfoLoader.GetSymbols (System.Boolean forceReload) [0x00000] in <367ea3bea40c4a39b8dbbc84cd441231>:0 

The TwinCAT.Ads thingy is the DLL I’m using to communicate.

Okay nevermind, just had to snoop around a little more. The I18N dlls that I was using came from the Unity\Hub\Editor\2019.3.15f1\Editor\Data\MonoBleedingEdge\lib\mono\unity folder, and using the ones in the Unity\Hub\Editor\2019.3.15f1\Editor\Data\MonoBleedingEdge\lib\mono\unityjit worked. I don’t understand why but it works anyways !