diff --git a/docs/website/mtouch-errors.md b/docs/website/mtouch-errors.md index d1238e5e7ffb..19f58c792c02 100644 --- a/docs/website/mtouch-errors.md +++ b/docs/website/mtouch-errors.md @@ -3555,11 +3555,7 @@ This indicates something is wrong in the build process. Please file a new issue This indicates an API wasn't bound correctly. If this is an API exposed by Xamarin, please file a new issue on [GitHub](https://github.com/xamarin/xamarin-macios/issues/new). If it's a third-party binding, please contact the vendor. - - -### MT8010: Native type size mismatch between Xamarin.[iOS|Mac].dll and the executing architecture. Xamarin.[iOS|Mac].dll was built for *-bit, while the current process is *-bit. - -This indicates something is wrong in the build process. Please file a new issue on [GitHub](https://github.com/xamarin/xamarin-macios/issues/new). + diff --git a/src/AppKit/NSGradient.cs b/src/AppKit/NSGradient.cs index 7f46357642ef..671da623a243 100644 --- a/src/AppKit/NSGradient.cs +++ b/src/AppKit/NSGradient.cs @@ -74,9 +74,6 @@ public NSGradient (NSColor [] colors, float [] locations, NSColorSpace colorSpac public NSGradient (NSColor [] colors, double [] locations, NSColorSpace colorSpace) : base (NSObjectFlag.Empty) { unsafe { - if (IntPtr.Size != 8) - throw new PlatformNotSupportedException ("Use the overload that takes an array of 'nfloat' values as locations instead."); - fixed (void* locationPtr = locations) { Initialize (colors, locations?.Length, (IntPtr) locationPtr, colorSpace); } diff --git a/src/ObjCRuntime/BindAs.cs b/src/ObjCRuntime/BindAs.cs index d62edbae066e..fac0858fdd4f 100644 --- a/src/ObjCRuntime/BindAs.cs +++ b/src/ObjCRuntime/BindAs.cs @@ -205,17 +205,7 @@ unsafe static IntPtr ConvertManagedArrayToNSArray2 (T []? array, delegate* static System.Single xamarin_nsnumber_to_float (IntPtr value) { if (value == IntPtr.Zero) return default (System.Single); return Runtime.GetNSObject (value)?.FloatValue ?? default (System.Single); } static System.Double xamarin_nsnumber_to_double (IntPtr value) { if (value == IntPtr.Zero) return default (System.Double); return Runtime.GetNSObject (value)?.DoubleValue ?? default (System.Double); } static System.Boolean xamarin_nsnumber_to_bool (IntPtr value) { if (value == IntPtr.Zero) return default (System.Boolean); return Runtime.GetNSObject (value)?.BoolValue ?? default (System.Boolean); } - static nfloat xamarin_nsnumber_to_nfloat (IntPtr value) - { - if (value == IntPtr.Zero) - return default (nfloat); - var number = Runtime.GetNSObject (value); - if (number is null) - return default (nfloat); - if (IntPtr.Size == 4) - return (nfloat) number.FloatValue; - return (nfloat) number.DoubleValue; - } + static nfloat xamarin_nsnumber_to_nfloat (IntPtr value) { if (value == IntPtr.Zero) return default (nfloat); return (nfloat?) Runtime.GetNSObject (value)?.DoubleValue ?? default (nfloat); } static System.SByte? xamarin_nsnumber_to_nullable_sbyte (IntPtr value) { return Runtime.GetNSObject (value)?.SByteValue ?? null; } static System.Byte? xamarin_nsnumber_to_nullable_byte (IntPtr value) { return Runtime.GetNSObject (value)?.ByteValue ?? null; } @@ -230,17 +220,7 @@ static nfloat xamarin_nsnumber_to_nfloat (IntPtr value) static System.Single? xamarin_nsnumber_to_nullable_float (IntPtr value) { return Runtime.GetNSObject (value)?.FloatValue ?? null; } static System.Double? xamarin_nsnumber_to_nullable_double (IntPtr value) { return Runtime.GetNSObject (value)?.DoubleValue ?? null; } static System.Boolean? xamarin_nsnumber_to_nullable_bool (IntPtr value) { return Runtime.GetNSObject (value)?.BoolValue ?? null; } - static nfloat? xamarin_nsnumber_to_nullable_nfloat (IntPtr value) - { - if (value == IntPtr.Zero) - return null; - var number = Runtime.GetNSObject (value); - if (number is null) - return null; - if (IntPtr.Size == 4) - return (nfloat) number.FloatValue; - return (nfloat) number.DoubleValue; - } + static nfloat? xamarin_nsnumber_to_nullable_nfloat (IntPtr value) { return (nfloat?) Runtime.GetNSObject (value)?.DoubleValue ?? null; } static IntPtr xamarin_sbyte_to_nsnumber (System.SByte value) { return NSNumber.FromSByte (value).DangerousRetain ().DangerousAutorelease ().Handle; } static IntPtr xamarin_byte_to_nsnumber (System.Byte value) { return NSNumber.FromByte (value).DangerousRetain ().DangerousAutorelease ().Handle; } @@ -255,12 +235,7 @@ static nfloat xamarin_nsnumber_to_nfloat (IntPtr value) static IntPtr xamarin_float_to_nsnumber (System.Single value) { return NSNumber.FromFloat (value).DangerousRetain ().DangerousAutorelease ().Handle; } static IntPtr xamarin_double_to_nsnumber (System.Double value) { return NSNumber.FromDouble (value).DangerousRetain ().DangerousAutorelease ().Handle; } static IntPtr xamarin_bool_to_nsnumber (System.Boolean value) { return NSNumber.FromBoolean (value).DangerousRetain ().DangerousAutorelease ().Handle; } - static IntPtr xamarin_nfloat_to_nsnumber (nfloat value) - { - if (IntPtr.Size == 4) - return NSNumber.FromFloat ((float) value).DangerousRetain ().DangerousAutorelease ().Handle; - return NSNumber.FromDouble ((double) value).DangerousRetain ().DangerousAutorelease ().Handle; - } + static IntPtr xamarin_nfloat_to_nsnumber (nfloat value) { return NSNumber.FromDouble ((double) value).DangerousRetain ().DangerousAutorelease ().Handle; } static IntPtr xamarin_nullable_sbyte_to_nsnumber (System.SByte? value) { if (!value.HasValue) return IntPtr.Zero; return NSNumber.FromSByte (value.Value).DangerousRetain ().DangerousAutorelease ().Handle; } static IntPtr xamarin_nullable_byte_to_nsnumber (System.Byte? value) { if (!value.HasValue) return IntPtr.Zero; return NSNumber.FromByte (value.Value).DangerousRetain ().DangerousAutorelease ().Handle; } @@ -275,13 +250,6 @@ static IntPtr xamarin_nfloat_to_nsnumber (nfloat value) static IntPtr xamarin_nullable_float_to_nsnumber (System.Single? value) { if (!value.HasValue) return IntPtr.Zero; return NSNumber.FromFloat (value.Value).DangerousRetain ().DangerousAutorelease ().Handle; } static IntPtr xamarin_nullable_double_to_nsnumber (System.Double? value) { if (!value.HasValue) return IntPtr.Zero; return NSNumber.FromDouble (value.Value).DangerousRetain ().DangerousAutorelease ().Handle; } static IntPtr xamarin_nullable_bool_to_nsnumber (System.Boolean? value) { if (!value.HasValue) return IntPtr.Zero; return NSNumber.FromBoolean (value.Value).DangerousRetain ().DangerousAutorelease ().Handle; } - static IntPtr xamarin_nullable_nfloat_to_nsnumber (nfloat? value) - { - if (!value.HasValue) - return IntPtr.Zero; - if (IntPtr.Size == 4) - return NSNumber.FromFloat ((float) value.Value).DangerousRetain ().DangerousAutorelease ().Handle; - return NSNumber.FromDouble ((double) value.Value).DangerousRetain ().DangerousAutorelease ().Handle; - } + static IntPtr xamarin_nullable_nfloat_to_nsnumber (nfloat? value) { if (!value.HasValue) return IntPtr.Zero; return NSNumber.FromDouble ((double) value.Value).DangerousRetain ().DangerousAutorelease ().Handle; } } } diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index 22e7c68f680a..3a1c829d79b6 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -327,12 +327,6 @@ unsafe static void Initialize (InitializationOptions* options) throw ErrorHelper.CreateError (8001, msg); } - if (IntPtr.Size != sizeof (nint)) { - string msg = $"Native type size mismatch between {AssemblyName} and the executing architecture. {AssemblyName} was built for {(IntPtr.Size == 4 ? 64 : 32)}-bit, while the current process is {(IntPtr.Size == 4 ? 32 : 64)}-bit."; - NSLog (msg); - throw ErrorHelper.CreateError (8010, msg); - } - if (System.Runtime.GCSettings.IsServerGC) { var msg = $".NET for {PlatformName} does not support server garbage collection."; NSLog (msg); @@ -2545,9 +2539,6 @@ public string Description { [BindingImpl (BindingImplOptions.Optimizable)] static bool GetIsARM64CallingConvention () { - if (IntPtr.Size != 8) - return false; - unsafe { return NXGetLocalArchInfo ()->Name.StartsWith ("arm64", StringComparison.OrdinalIgnoreCase); } diff --git a/src/ObjCRuntime/TypeConverter.cs b/src/ObjCRuntime/TypeConverter.cs index 09d96354ec0c..ede94c3f44e1 100644 --- a/src/ObjCRuntime/TypeConverter.cs +++ b/src/ObjCRuntime/TypeConverter.cs @@ -140,9 +140,9 @@ public static string ToNative (Type type) if (type == typeof (string)) return "@"; // We handle NSString as MonoString automagicaly if (type == typeof (Selector)) return ":"; if (type == typeof (Class)) return "#"; - if (type == typeof (nfloat)) return IntPtr.Size == 8 ? "d" : "f"; - if (type == typeof (nint)) return IntPtr.Size == 8 ? "q" : "i"; - if (type == typeof (nuint)) return IntPtr.Size == 8 ? "Q" : "I"; + if (type == typeof (nfloat)) return "d"; + if (type == typeof (nint)) return "q"; + if (type == typeof (nuint)) return "Q"; if (typeof (INativeObject).IsAssignableFrom (type)) return "@"; if (type.IsValueType && !type.IsEnum) { // TODO: We should cache the results of this in a temporary hash that we destroy when we're done initializing/registrations diff --git a/src/WebKit/WKWindowFeatures.cs b/src/WebKit/WKWindowFeatures.cs index 01ffe7f72b40..bfbb9dcfb112 100644 --- a/src/WebKit/WKWindowFeatures.cs +++ b/src/WebKit/WKWindowFeatures.cs @@ -48,8 +48,6 @@ public bool? AllowsResizing { { if (number is null) return null; - else if (IntPtr.Size == 4) - return (nfloat) number.FloatValue; else return (nfloat) number.DoubleValue; }