The following happens when I start my C# resource on my Linux server (artifact build 3404)
Could not load assembly System.Security - loading exceptions: Exception loading assembly System.Security: System.IO.FileNotFoundException: Unable to find the specified file.
Server stack trace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (System.Int32 errorCode) [0x0000a] in <4fffd39960df419684f9b9cb5ce46688>:0
at (wrapper cominterop) CitizenFX.Core.IScriptHost.OpenHostFile(string)
at (wrapper cominterop-invoke) CitizenFX.Core.IScriptHost.OpenHostFile(string)
at CitizenFX.Core.MonoScriptRuntime+WrapScriptHost.OpenHostFile (System.String fileName) [0x00000] in /src/code/client/clrcore/MonoScriptRuntime.cs:374
at (wrapper remoting-invoke-with-check) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost.OpenHostFile(string)
at (wrapper xdomain-dispatch) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost.OpenHostFile(object,byte[]&,byte[]&,string)
Exception rethrown at [0]:
at (wrapper xdomain-invoke) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost.OpenHostFile(string)
at CitizenFX.Core.InternalManager.LoadAssemblyInternal (System.String baseName, System.Boolean useSearchPaths) [0x00075] in /src/code/client/clrcore/InternalManager.cs:206
Exception loading assembly bin/server/System.Security: System.BadImageFormatException: 0x0x7f11c39bd030
File name: 'In Memory assembly'
at (wrapper managed-to-native) System.AppDomain.LoadAssemblyRaw(System.AppDomain,byte[],byte[],System.Security.Policy.Evidence,bool)
at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence, System.Boolean refonly) [0x0000e] in <4fffd39960df419684f9b9cb5ce46688>:0
at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence) [0x00000] in <4fffd39960df419684f9b9cb5ce46688>:0
at (wrapper remoting-invoke-with-check) System.AppDomain.Load(byte[],byte[],System.Security.Policy.Evidence)
at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore) [0x00000] in <4fffd39960df419684f9b9cb5ce46688>:0
at (wrapper remoting-invoke-with-check) System.AppDomain.Load(byte[],byte[])
at System.Reflection.Assembly.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore) [0x00005] in <4fffd39960df419684f9b9cb5ce46688>:0
at CitizenFX.Core.InternalManager.CreateAssemblyInternal (System.String assemblyFile, System.Byte[] assemblyData, System.Byte[] symbolData) [0x00019] in /src/code/client/clrcore/InternalManager.cs:123
at CitizenFX.Core.InternalManager.LoadAssemblyInternal (System.String baseName, System.Boolean useSearchPaths) [0x00177] in /src/code/client/clrcore/InternalManager.cs:245
That happens after the following script :
Instantiated instance of script Gtacnr.Server.Authentication.AuthenticationScript.
Which uses:
using CitizenFX.Core;
using Sasinosoft.GamesAPI;
using System;
using System.Net.Mail;
using static CitizenFX.Core.Native.API;
I tried to:
- build for different .NET versions (4.6.1, 4.7.1, 4.7.2)
- copied System.Security.dll to the production environment in the binary folder of the resource (resource/bin/server)
- copied the System.Security.dll file to FiveM’s mono folder in /alpine/opt/cfx-server/citizen/clr2/lib/mono/4.5
Notice that the resource works fine on Windows.
Any help appreciated, thanks