I'm trying to write a relatively simple interface to use a C# library in GameMaker, and I'm fairly certain the issue is on the C# side. I have very low familiarity with both the language and Visual Studio, so I'm way out of my depth here. This is the C# class which calls on the external library I want to use:
using UndertaleModLib;using UndertaleModLib.Project;namespace UndertaleProjectMan{ public class ProjectInstaller { private UndertaleData? Data { get; set; } private void SaveDataFile(string outputPath) { try { // Save data.win to temp file using (FileStream fs = new(outputPath +"temp", FileMode.Create, FileAccess.Write)) { UndertaleIO.Write(fs, Data); } // If we're executing this, the saving was successful. So we can replace the new temp file // with the older file, if it exists. File.Move(outputPath +"temp", outputPath, true); } catch (Exception e) { // Delete the temporary file in case we partially wrote it if (File.Exists(outputPath +"temp")) File.Delete(outputPath +"temp"); throw new IOException($"Could not save data file: {e.Message}"); } } private void ReadDataFile(string inputPath) { try { using FileStream fs = new FileStream(inputPath, FileMode.Open, FileAccess.Read); Data = UndertaleIO.Read(fs, (string warning, bool isImportant) => Console.WriteLine($"[WARNING]: {warning}"), (string message) => Console.WriteLine($"[MESSAGE]: {message}")); } catch (FileNotFoundException e) { throw new FileNotFoundException($"Data file '{e.FileName}' does not exist"); } } public void InstallProject(string dataPath, string projectPath) { ReadDataFile(dataPath); ProjectContext project = ProjectContext.CreateWithDataFilePaths(dataPath, dataPath, projectPath); project.Import(Data, new GameFileNoOpBackup()); SaveDataFile(dataPath); } }}And the C++ which calls the InstallProject method:
#include <filesystem>#define EXPORT_SPEC extern "C" __declspec(dllexport)#define MANAGED_STR(pString) System::Runtime::InteropServices::Marshal::PtrToStringAnsi(System::IntPtr((char*)pString))EXPORT_SPEC double EX_ModmanBackupCreate(const char* sourcePath, const char* destPath, const char* destDir) { std::filesystem::create_directories(destDir); if (std::filesystem::copy_file(sourcePath, destPath)) return 1.0; return 0.0;}EXPORT_SPEC double EX_ModmanBackupRestore(const char* destPath, const char* sourcePath) { const auto copyOptions = std::filesystem::copy_options::overwrite_existing; if (std::filesystem::copy_file(sourcePath, destPath, copyOptions)) return 1.0; return 0.0;}EXPORT_SPEC double EX_ModmanInstallMod(const char* dataPath, const char* modPath) { UndertaleProjectMan::ProjectInstaller^ pj = gcnew UndertaleProjectMan::ProjectInstaller(); pj->InstallProject(MANAGED_STR(dataPath), MANAGED_STR(modPath)); return 1.0;}I have all the same dependencies set up in both of these projects' NuGet managers as the library I'm trying to use. EX_ModmanBackupCreate and EX_ModmanBackupRestore are working fine, but it crashes on calling EX_ModmanInstallMod. This function from the library I'm using is outputting this error to the file unserializeCountError.txt:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621) at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at UndertaleModLib.UndertaleReader.FillUnserializeCountDictionaries() in C:\DirectoryObfuscatedForPrivacy\UndertaleModTool\UndertaleModLib\UndertaleIO.cs:line 431System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)File name: 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath) at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)File name: 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath) at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)File name: 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath) at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)File name: 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath) at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)Unable to load one or more of the requested types.Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)Could not load file or assembly 'System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621) at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at UndertaleModLib.UndertaleReader.FillUnserializeCountDictionaries() in C:\DirectoryObfuscatedForPrivacy\UndertaleModTool\UndertaleModLib\UndertaleIO.cs:line 431I also tried attaching a debugger to the executable in Visual Studio, and I'm getting this output from it:
'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\ModManager.exe'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\wininet.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\d3d11.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dbghelp.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.5915_none_919facb6cc8c4195\GdiPlus.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\comdlg32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.5915_none_60b4b9d171f9c7c7\comctl32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\mfplat.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\mfreadwrite.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\propsys.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\IPHLPAPI.DLL'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dxgi.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dbgcore.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\RTWorkQ.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\MMDevAPI.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\ModManLib.dll'. Symbols loaded.'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Ijwhost.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Underanalyzer.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\UndertaleModLib.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\UndertaleProjectMan.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\ICSharpCode.SharpZipLib.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Magick.NET.Core.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Magick.NET-Q8-AnyCPU.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Microsoft.CodeAnalysis.CSharp.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Microsoft.CodeAnalysis.CSharp.Scripting.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Microsoft.CodeAnalysis.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\Microsoft.CodeAnalysis.Scripting.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\PropertyChanged.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\System.Collections.Immutable.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\System.IO.Pipelines.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\System.Reflection.Metadata.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\System.Text.Encodings.Web.dll'. 'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\System.Text.Json.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\IconCodecService.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\WindowsCodecs.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\u0375339.inf_amd64_0dfd867fa9db30b6\B373692\aticfx64.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\u0375339.inf_amd64_0dfd867fa9db30b6\B373692\atiuxp64.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\u0375339.inf_amd64_0dfd867fa9db30b6\B373692\atidxx64.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\apphelp.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\amdihk64.dll'. Module was built without symbols.'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\DXCore.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\wldp.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\D3DSCache.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\userenv.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\AudioSes.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\powrprof.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\umpdc.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\xinput1_3.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dinput8.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\hid.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\InputHost.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\wintrust.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dhcpcsvc6.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dhcpcsvc.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dnsapi.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\dcomp.dll'. The thread 21476 has exited with code 0 (0x0).'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\host\fxr\8.0.10\hostfxr.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\hostpolicy.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\coreclr.dll'. Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0x04242420 (parameters: 0x0000000031415927, 0x00007FFF70D30000, 0x000000000014D8B0).'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Private.CoreLib.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\clrjit.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Windows\System32\icu.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Runtime.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Threading.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Runtime.Extensions.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Runtime.InteropServices.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Collections.NonGeneric.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Runtime.CompilerServices.VisualC.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Linq.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Collections.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Text.Encoding.Extensions.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.ObjectModel.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Text.Json.dll'. 'ModManager.exe' (Win32): Unloaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Text.Json.dll'Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEMessageException at memory location 0x00000000001490F0.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEMessageException at memory location 0x00000000001490F0.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEMessageException at memory location 0x00000000001490F0.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEMessageException at memory location 0x00000000001490F0.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131621, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.Exception thrown at 0x00007FF83D245339 in ModManager.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000000000144940.Exception thrown at 0x00007FF83D245339 (KernelBase.dll) in ModManager.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131602, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFF70D30000).'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Memory.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Diagnostics.StackTrace.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Reflection.Metadata.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Collections.Immutable.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.IO.Compression.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.IO.Compression.Native.dll'. 'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Console.dll'. Exception thrown at 0x00007FFF11323257 in ModManager.exe: 0xC0000005: Access violation reading location 0x0000000000000000.The program '[5932] ModManager.exe' has exited with code 0 (0x0).I've been stuck on this problem for quite a while because I'm at a loss as to what to try to fix this. I read through loads of instances of other people failing to load the System.Text.Json dependency, or a dependency in general in a C++/CLI project, but none of the solutions I've found seem to apply to my case. I'm using CopyLocalLockFileAssemblies in my project configuration so that all the dependencies are added to the build output, and from the debug log it seems to be loading them as intended:
'ModManager.exe' (Win32): Loaded 'C:\DirectoryObfuscatedForPrivacy\ModManager\System.Text.Json.dll'. But for some reason it also seems to be loading from my .NET distribution:
'ModManager.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Text.Json.dll'. 'ModManager.exe' (Win32): Unloaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.10\System.Text.Json.dll'One person I asked for help suggested I add the [DllExport] attribute to the C# function I'm trying to call from the C++/CLI project, which I did, but it didn't seem to change anything.
Ideally, I won't have to make any modifications to the C# library I'm trying to use to fix this, but since it's open-source I can if absolutely nessecary.