SpickeyCactus
SpickeyCactus
CC#
Created by SpickeyCactus on 2/4/2024 in #help
System.TypeLoadException error when executing a dll created via c# .net standard library
i compiled an open source code (from github) into a dll, the code changes an executable's icon and id like to use said code in my python project so i compiled it into a dll and loaded it via using clr (a lib which lets you load c#-compiled dll's into python) it loads in without error and gets improrted fine, the issue is upon excuting a method of the class inside the dll i get the exception
System.TypeLoadException: Could not load type 'System.Runtime.InteropServices.GCHandle' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at IconInject.IconInjector.IconFile.FromFile(String filename)
at IconInject.IconInjector.InjectIcon(String exeFileName, String iconFileName, UInt32 iconGroupID, UInt32 iconBaseID)
at IconInject.IconInjector.InjectIcon(String exeFileName, String iconFileName)
System.TypeLoadException: Could not load type 'System.Runtime.InteropServices.GCHandle' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at IconInject.IconInjector.IconFile.FromFile(String filename)
at IconInject.IconInjector.InjectIcon(String exeFileName, String iconFileName, UInt32 iconGroupID, UInt32 iconBaseID)
at IconInject.IconInjector.InjectIcon(String exeFileName, String iconFileName)
i compiled and loaded multiple sample dlls (simple ones) and they ran fine without issue, from what i gather its an import issue of GCHandle which is (if i understand correctly) unmanged memory allocator im very very newbie with c# and program mostly in python, but i like how fast and verstile c# while prefering the syntax and ease of use of python, hence i use c#- compiled dll's with python, mostly without issues, any help will be appricated!
7 replies