I got 'System.NotImplementedException' when generating C File

Apr 21, 2015 at 8:03 AM
Hello there, i am just beginner and trying to make my game compiled in native.

Let's say, my game lib is 'Game.Engine.dll' and its dependencies is OpenTK.dll (OpenGL library) so i put those files together, the game executable name is "Game.exe".
Then i type this command:
IL2C Game.Engine.dll /corelib:CoreLib.dll
and I got an error:
Unhandled Exception: System.Exception: Assembly 'System.Drawing, Version=2.0.0.0, Culture= neutral, PublicKeyToken=b03f5f7f11d50a3a' is missing
So i went to my Windows folder and copy things manually from Microsoft.NET folder, after that, it asking System.dll and System.Windows.Forms.dll too, so i copy them as well to the same folder.

then I try to type the command once again
IL2C Game.Engine.dll /corelib:CoreLib.dll
and then it give me another exception, and i have no idea how to workaround against this:
Generating C file...
Unhandled Exception: System.NotImplementedException: The method or operation is not implem
ented.
   at PEAssemblyReader.MetadataModuleAdapter.ResolveMember(Int32 token, IGenericContext ge
nericContext)
   at Il2Native.Logic.IlReader.<OpCodes>d__43.MoveNext()
   at Il2Native.Logic.IlReader.<OpCodes>d__3b.MoveNext()
   at Il2Native.Logic.OpCodeExtensions.DiscoverStructsArraysSpecializedTypesAndMethodsInMe
thodBody(IMethod method, ISet`1 genericTypeSpecializations, ISet`1 genericMethodSpecializa
tions, ISet`1 structTypes, ISet`1 arrayTypes, Queue`1 stackCall, ITypeResolver typeResolve
r)
   at Il2Native.Logic.IlReader.DiscoverRequiredTypesAndMethodsInMethod(IMethod method, Que
ue`1 stackCall)
   at Il2Native.Logic.IlReader.AddGenericSpecializedMethod(IMethod method, Queue`1 stackCa
ll)
   at Il2Native.Logic.IlReader.<OpCodes>d__43.MoveNext()
   at Il2Native.Logic.IlReader.<OpCodes>d__3b.MoveNext()
   at Il2Native.Logic.OpCodeExtensions.DiscoverStructsArraysSpecializedTypesAndMethodsInMe
thodBody(IMethod method, ISet`1 genericTypeSpecializations, ISet`1 genericMethodSpecializa
tions, ISet`1 structTypes, ISet`1 arrayTypes, Queue`1 stackCall, ITypeResolver typeResolve
r)
   at Il2Native.Logic.Il2Converter.DiscoverGenericSpecializedTypesAndAdditionalTypes(IMeth
od method, ReadingTypesContext readingTypesContext)
   at Il2Native.Logic.Il2Converter.DiscoverGenericSpecializedTypesAndAdditionalTypes(IType
 typeSource, ReadingTypesContext readingTypesContext)
   at Il2Native.Logic.Il2Converter.AppendTypeAndDiscoverGenericSpecializedTypesAndAddition
alTypes(IType type, IList`1 requiredTypesByType, ReadingTypesContext readingTypesContext)
   at Il2Native.Logic.Il2Converter.FindUsedTypes(IEnumerable`1 types, IList`1 allTypes, Re
adingTypesContext readingTypesContext)
   at Il2Native.Logic.Il2Converter.ReadingTypes(IlReader ilReader, String[] filter, IDicti
onary`2& genericMethodSpecializationsSorted)
   at Il2Native.Logic.Il2Converter.GenerateSource(IlReader ilReader, String[] filter, ICod
eWriter codeWriter)
   at Il2Native.Logic.Il2Converter.GenerateC(IlReader ilReader, String fileName, String so
urceFilePath, String pdbFilePath, String outputFolder, String[] args, String[] filter)
   at Il2Native.Logic.Il2Converter.Convert(String[] sources, String outputFolder, String[]
 args, String[] filter)
   at Il2Native.Program.Main(String[] args)
Any ideas?
Thanks

oh and how can i compile it together, so Game.Engine.dll and Game.exe merge into one native executable?
Coordinator
Apr 21, 2015 at 8:40 AM
Edited Apr 21, 2015 at 7:23 PM
Thank you for your feedback. Unfortunately it is too early to compile any .NET DLL with IL2C. As it not supporting Reflection and thus not all code will be executable but compilable.

So mscorlib.dll can't be compiled yet as it is too big for C++ compiler. As Windows.Forms heavily depends on mscorlib.dll even if you manage to compile it, it will not work.

And regarding your issue. The app tries to resolve generic member it could not do it as member is not type of method. I will have a look. Could you tell me all dll which your are trying compiling.

PS. I am going to update it soon
Apr 21, 2015 at 8:49 AM
Edited Apr 21, 2015 at 8:50 AM
AlexDev wrote:
Thank you for your feedback. Unfortunately it is too early to compile any .NET DLL with IL2C. As it not supporting Reflection and thus not all code will not be executable but compilable.

So mscorlib.dll can't be compiled yet as it is too big for C++ compiler. As Windows.Forms heavily depends on mscorlib.dll even if you manage to compile it, it will not work.
I see, anyway hmmm.. how can i make all my projects to be compilable? do i have to manually generate C file one by one (eg: IL2C a.cs b.cs c.cs and so on, that is nearly impossible haha)

actually, my game didnt really require System.Windows.Forms, it's just for testing purpose, but heavily require System.Drawing
And regarding your issue. The app tries to resolve generic member it could not do it as member is not type of method. I will have a look. Could you tell me all dll which your are trying compiling.
I was trying generate C Files of my Game library that uses SharpZipLib, NVorbis (their sources are included in my project) and OpenTK.dll
PS. I am going to update it soon
THE BEST! (Y)
Coordinator
Apr 21, 2015 at 9:55 AM
CXO2 wrote:
I see, anyway hmmm.. how can i make all my projects to be compilable? do i have to manually generate C file one by one (eg: IL2C a.cs b.cs c.cs and so on, that is nearly impossible haha)
Yes, now you need to convert each DLL into C file and then compile it with g++. I will have a look later how I can speed up the process. I am planning to generate CMake file to compile everything in one go.

Thx.