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. |
knah
left a comment
There was a problem hiding this comment.
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.
| { | ||
| var oldType = typeContext.OriginalType; | ||
| var newType = typeContext.NewType; | ||
| if (newType.IsEnum) return; |
There was a problem hiding this comment.
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.
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.
| { | ||
| 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.
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.
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. |
| is also invalid .net (where mono doesn't care). I think we can remove it without any issue, and this looks like a bug anyway. If any method in an injected class returns a non-void value, it would return here instead of actually returning the result. |
|
My GC was free'ing the TypeToClassDelegate from as well. This delegate should be alloc'd, or made static, correct? Doing so fixes my implementation. The other delegatehookedClassFromName 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