-
Notifications
You must be signed in to change notification settings - Fork 87
netcore support #67
base: master
Are you sure you want to change the base?
netcore support #67
Conversation
As I understand things, now that 0.4.15.3 has been released, all changes should be directed to the v0.5.x-wip branch. One of the goals for v0.5 is generation of assemblies that are compatible with dot net 5. For example, Pass 24 has already been removed in eeaa230 You can view more information about v0.5 in the documentation folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it is right now, it introduces regressions. 0.5.x rewrite might be the better place to introduce large changes, such as removing static constructors from enums without breaking things.
@@ -24,6 +24,7 @@ private static void GenerateStaticProxy(AssemblyRewriteContext assemblyContext, | |||
{ | |||
var oldType = typeContext.OriginalType; | |||
var newType = typeContext.NewType; | |||
if (newType.IsEnum) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing static constructors from enum types will likely break practically everything that uses them, including boxed enums and generics with enum type parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to find an example that uses a static constructor for an enum type. Do you happen to have one? I tried a generic method (i.e. from https://stackoverflow.com/questions/79126/create-generic-method-constraining-t-to-an-enum), but can't get mono working with it yet.
@@ -149,8 +150,8 @@ private static void EmitLoadTypeNameString(this ILProcessor ctorBuilder, Assembl | |||
ctorBuilder.Emit(OpCodes.Ldstr, originalTypeReference.FullName); | |||
else | |||
{ | |||
ctorBuilder.Emit(newTypeReference.IsByReference ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0); | |||
ctorBuilder.Emit(OpCodes.Call, imports.Module.ImportReference(new GenericInstanceMethod(imports.Il2CppRenderTypeNameGeneric) {GenericArguments = {newTypeReference}})); | |||
ctorBuilder.Emit(newTypeReference.IsByReference ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be only used for methods that somehow don't get a token (in fact, this should have been removed a long time ago as in practice everything has tokens). It would be better to actually investigate those cases when there are tokenless methods and fix those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the case of:
IL2CPP.RenderTypeName<someType*>(true)
- .net doesn’t like class pointers as a generic type input.
I’ll look at 0.5. Will keep this open in the meantime for discussion if that’s okay. |
|
My GC was free'ing the TypeToClassDelegate from
hookedClassFromName is static, so it doesn't get GC'd ever.
Edit - nvm, fixed here
|
note - this also forces all types to not be sequential. need to filter better. this pr addresses #44