@@ -84,8 +84,8 @@ public T Unbox<T>() where T : unmanaged
8484 private static readonly Type [ ] _intPtrTypeArray = { typeof ( IntPtr ) } ;
8585 private static readonly MethodInfo _getUninitializedObject = typeof ( RuntimeHelpers ) . GetMethod ( nameof ( RuntimeHelpers . GetUninitializedObject ) ) ! ;
8686 private static readonly MethodInfo _getTypeFromHandle = typeof ( Type ) . GetMethod ( nameof ( Type . GetTypeFromHandle ) ) ! ;
87- private static readonly MethodInfo _createGCHandle = typeof ( Il2CppObjectBase ) . GetMethod ( nameof ( CreateGCHandle ) ) ! ;
88- private static readonly FieldInfo _isWrapped = typeof ( Il2CppObjectBase ) . GetField ( nameof ( isWrapped ) ) ! ;
87+ private static readonly MethodInfo _createGCHandle = typeof ( Il2CppObjectBase ) . GetMethod ( nameof ( CreateGCHandle ) , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
88+ private static readonly FieldInfo _isWrapped = typeof ( Il2CppObjectBase ) . GetField ( nameof ( isWrapped ) , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
8989
9090 internal static class InitializerStore < T >
9191 {
@@ -112,7 +112,7 @@ private static Func<IntPtr, T> Create()
112112 // However, it could be be user-made or implicit
113113 // In that case we set the GCHandle and then call the ctor and let GC destroy any objects created by DerivedConstructorPointer
114114
115- // var obj = (T)FormatterServices .GetUninitializedObject(type);
115+ // var obj = (T)RuntimeHelpers .GetUninitializedObject(type);
116116 il . Emit ( OpCodes . Ldtoken , type ) ;
117117 il . Emit ( OpCodes . Call , _getTypeFromHandle ) ;
118118 il . Emit ( OpCodes . Call , _getUninitializedObject ) ;
@@ -126,7 +126,7 @@ private static Func<IntPtr, T> Create()
126126 // obj.isWrapped = true;
127127 il . Emit ( OpCodes . Dup ) ;
128128 il . Emit ( OpCodes . Ldc_I4_1 ) ;
129- il . Emit ( OpCodes . Stsfld , _isWrapped ) ;
129+ il . Emit ( OpCodes . Stfld , _isWrapped ) ;
130130
131131 var parameterlessConstructor = type . GetConstructor ( BindingFlags . Instance | BindingFlags . Public | BindingFlags . NonPublic , Type . EmptyTypes ) ;
132132 if ( parameterlessConstructor != null )
0 commit comments