diff --git a/dotnet/BreakingChanges.md b/dotnet/BreakingChanges.md new file mode 100644 index 0000000000..4c31f04345 --- /dev/null +++ b/dotnet/BreakingChanges.md @@ -0,0 +1,21 @@ +# Breaking changes in .NET + +## System.nfloat moved to ObjCRuntime.nfloat + +The `nfloat` type moved from the `System` namespace to the `ObjCRuntime` namespace. + +* Code that references the `nfloat` type might not compile unless the `ObjCRuntime` namespace is imported. + + Fix: add `using ObjCRuntime` to the file in question. + +* Code that references the full typename, `System.nfloat` won't compile. + + Fix: use `ObjCRuntime.nfloat` instead. + +## System.NMath moved to ObjCRuntime.NMath + +The `NMath` type moved from the `System` namespace to the `ObjCRuntime` namespace. + +* Code that uses the `NMath` type won't compile unless the `ObjCRuntime` namespace is imported. + + Fix: add `using ObjCRuntime` to the file in question. diff --git a/external/MonoTouch.Dialog b/external/MonoTouch.Dialog index 8e60f82a1a..5a05c6912e 160000 --- a/external/MonoTouch.Dialog +++ b/external/MonoTouch.Dialog @@ -1 +1 @@ -Subproject commit 8e60f82a1ab0fba5e798624edd488736870bb0d7 +Subproject commit 5a05c6912ef3828271557d9daaaec172c5fb45c2 diff --git a/external/Touch.Unit b/external/Touch.Unit index 3345db2f4e..cbda703583 160000 --- a/external/Touch.Unit +++ b/external/Touch.Unit @@ -1 +1 @@ -Subproject commit 3345db2f4e6408fdf2e8f099251c5c1310b56937 +Subproject commit cbda70358360329854ea399100a2b5b04ae43982 diff --git a/runtime/trampolines.m b/runtime/trampolines.m index 4933d9127d..fa628835db 100644 --- a/runtime/trampolines.m +++ b/runtime/trampolines.m @@ -1513,7 +1513,11 @@ xamarin_get_nsnumber_converter (MonoClass *managedType, MonoMethod *method, bool func = to_managed ? (void *) xamarin_nsnumber_to_nint : (void *) xamarin_nint_to_nsnumber; } else if (!strcmp (fullname, "System.nuint")) { func = to_managed ? (void *) xamarin_nsnumber_to_nuint : (void *) xamarin_nuint_to_nsnumber; +#if DOTNET + } else if (!strcmp (fullname, "ObjCRuntime.nfloat")) { +#else } else if (!strcmp (fullname, "System.nfloat")) { +#endif func = to_managed ? (void *) xamarin_nsnumber_to_nfloat : (void *) xamarin_nfloat_to_nsnumber; } else if (mono_class_is_enum (managedType)) { MonoType *baseType = mono_class_enum_basetype (managedType); diff --git a/src/AppKit/Defs.cs b/src/AppKit/Defs.cs index 2d780a32a9..cb3b1e62a3 100644 --- a/src/AppKit/Defs.cs +++ b/src/AppKit/Defs.cs @@ -22,6 +22,9 @@ // using System; using System.Runtime.InteropServices; + +using ObjCRuntime; + namespace AppKit { [StructLayout (LayoutKind.Sequential)] public struct NSEdgeInsets { diff --git a/src/AppKit/NSEvent.cs b/src/AppKit/NSEvent.cs index 3473ce70d2..881b59771b 100644 --- a/src/AppKit/NSEvent.cs +++ b/src/AppKit/NSEvent.cs @@ -1,8 +1,10 @@ #if !__MACCATALYST__ using System; using System.Diagnostics; + using Foundation; using CoreGraphics; +using ObjCRuntime; namespace AppKit { diff --git a/src/Foundation/NSNumber.mac.cs b/src/Foundation/NSNumber.mac.cs index 3624622103..c55309f33f 100644 --- a/src/Foundation/NSNumber.mac.cs +++ b/src/Foundation/NSNumber.mac.cs @@ -9,6 +9,7 @@ #if MONOMAC using System; +using ObjCRuntime; namespace Foundation { diff --git a/src/NativeTypes/NMath.cs b/src/NativeTypes/NMath.cs index a2bc61b63e..4a09bb06d4 100644 --- a/src/NativeTypes/NMath.cs +++ b/src/NativeTypes/NMath.cs @@ -7,9 +7,14 @@ // Copyright 2014 Xamarin Inc. All rights reserved. // +using System; using System.Runtime.CompilerServices; +#if NET +namespace ObjCRuntime +#else namespace System +#endif { public static class NMath { diff --git a/src/NativeTypes/Primitives.tt b/src/NativeTypes/Primitives.tt index b137bcf280..eaa1725fa8 100644 --- a/src/NativeTypes/Primitives.tt +++ b/src/NativeTypes/Primitives.tt @@ -24,6 +24,10 @@ // Copyright 2013 Xamarin, Inc. All rights reserved. // +#if NET +#define OBJCRUNTIME_nfloat +#endif + <#@ template language="C#v3.5" #> <#@ import namespace="System" #> <#@ import namespace="System.Collections.Generic" #> @@ -32,8 +36,8 @@ using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; -namespace System -{ +using ObjCRuntime; + <# foreach (var type in new [] { new { NSName = "nint", CilName32 = "Int32", CilName64 = "Int64", IsIntegerType = true }, @@ -56,6 +60,12 @@ namespace System binops.Add ("^"); } #> +#if OBJCRUNTIME_<#= type.NSName #> +namespace ObjCRuntime +#else +namespace System +#endif +{ [Serializable] [DebuggerDisplay ("{v,nq}")] public unsafe struct <#= type.NSName #> : IFormattable, IConvertible, IComparable, IComparable<<#= type.NSName #>>, IEquatable <<#= type.NSName #>> @@ -429,5 +439,5 @@ namespace System Marshal.WriteIntPtr (destination, i * <#= type.NSName #>.Size, (IntPtr)source [i + startIndex]); } } -<# } #> } +<# } #> diff --git a/src/ObjCRuntime/Registrar.cs b/src/ObjCRuntime/Registrar.cs index c7c636a514..ad360aa75f 100644 --- a/src/ObjCRuntime/Registrar.cs +++ b/src/ObjCRuntime/Registrar.cs @@ -88,6 +88,14 @@ namespace Registrar { public Application App { get; protected set; } #endif +#if MMP || MTOUCH || BUNDLER + static string NFloatTypeName { get => Driver.IsDotNet ? "ObjCRuntime.nfloat" : "System.nfloat"; } +#elif NET + const string NFloatTypeName = "ObjCRuntime.nfloat"; +#else + const string NFloatTypeName = "System.nfloat"; +#endif + Dictionary assemblies = new Dictionary (); // Use Dictionary instead of HashSet to avoid pulling in System.Core.dll. // locking: all accesses must lock 'types'. Dictionary types = new Dictionary (); @@ -715,10 +723,11 @@ namespace Registrar { case "System.nuint": case "System.Single": case "System.Double": - case "System.nfloat": case "System.Boolean": return true; default: + if (outputTypeName == NFloatTypeName) + return true; return Registrar.IsEnum (underlyingOutputType); } } else if (Registrar.Is (underlyingInputType, Foundation, "NSValue")) { @@ -2641,12 +2650,13 @@ namespace Registrar { return Is64Bits ? "q" : "i"; case "System.nuint": return Is64Bits ? "Q" : "I"; - case "System.nfloat": - return Is64Bits ? "d" : "f"; case "System.DateTime": throw CreateException (4102, member, Errors.MT4102, "System.DateTime", "Foundation.NSDate", member.FullName); } + if (typeFullName == NFloatTypeName) + return Is64Bits ? "d" : "f"; + if (Is (type, ObjCRuntime, "Selector")) return ":"; diff --git a/src/ObjCRuntime/Stret.cs b/src/ObjCRuntime/Stret.cs index 43f8bf0479..194907ce1d 100644 --- a/src/ObjCRuntime/Stret.cs +++ b/src/ObjCRuntime/Stret.cs @@ -226,6 +226,13 @@ namespace ObjCRuntime if (type.IsNested) return false; +#if NET + if (type.Namespace == "ObjCRuntime" && type.Name == "nfloat") { + type_size = is_64_bits ? 8 : 4; + return true; + } +#endif + if (type.Namespace != "System") return false; @@ -251,7 +258,9 @@ namespace ObjCRuntime type_size = 8; return true; case "IntPtr": +#if !NET case "nfloat": +#endif case "nuint": case "nint": type_size = is_64_bits ? 8 : 4; diff --git a/src/PdfKit/PdfCompat.cs b/src/PdfKit/PdfCompat.cs index dec9c7c85f..39f46ce678 100644 --- a/src/PdfKit/PdfCompat.cs +++ b/src/PdfKit/PdfCompat.cs @@ -1,6 +1,8 @@ #if !XAMCORE_4_0 using System; + using Foundation; +using ObjCRuntime; #nullable enable diff --git a/src/PdfKit/PdfKit.cs b/src/PdfKit/PdfKit.cs index 852090c28f..9da11456e1 100644 --- a/src/PdfKit/PdfKit.cs +++ b/src/PdfKit/PdfKit.cs @@ -2,6 +2,7 @@ using System; using CoreGraphics; using Foundation; +using ObjCRuntime; #nullable enable diff --git a/src/README.md b/src/README.md index 1bbdfd8889..cef8d3d634 100644 --- a/src/README.md +++ b/src/README.md @@ -107,7 +107,7 @@ We have introduced 6 new types to make this possible: In the Classic assembly, the `System.Drawing` types are backed by the 32-bit `System.Single` type. In the Unified assemblies, the `CoreGraphics` types -are backed by 32/64-bit `System.nfloat` type. +are backed by 32/64-bit `System.nfloat` type (`ObjCRuntime.nfloat` in .NET). #### Enums #### diff --git a/src/SceneKit/Constructors.cs b/src/SceneKit/Constructors.cs index e4371d0b98..beba2a9b87 100644 --- a/src/SceneKit/Constructors.cs +++ b/src/SceneKit/Constructors.cs @@ -9,7 +9,9 @@ // Copyright 2012 Xamarin Inc // using System; + using Foundation; +using ObjCRuntime; #nullable enable diff --git a/src/SceneKit/SCNMatrix4.cs b/src/SceneKit/SCNMatrix4.cs index 1cf8db81e5..2e46bdbb20 100644 --- a/src/SceneKit/SCNMatrix4.cs +++ b/src/SceneKit/SCNMatrix4.cs @@ -36,7 +36,11 @@ using Vector4 = global::OpenTK.Vector4; using Quaternion = global::OpenTK.Quaternion; using Quaterniond = global::OpenTK.Quaterniond; #if MONOMAC +#if NET +using pfloat = ObjCRuntime.nfloat; +#else using pfloat = System.nfloat; +#endif #else using pfloat = System.Single; #endif diff --git a/src/SceneKit/SCNNode.cs b/src/SceneKit/SCNNode.cs index 2bd4f55e58..7199c86d07 100644 --- a/src/SceneKit/SCNNode.cs +++ b/src/SceneKit/SCNNode.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using CoreAnimation; #endif using Foundation; +using ObjCRuntime; #nullable enable diff --git a/src/SceneKit/SCNQuaternion.cs b/src/SceneKit/SCNQuaternion.cs index 0cd7185849..140282f9bc 100644 --- a/src/SceneKit/SCNQuaternion.cs +++ b/src/SceneKit/SCNQuaternion.cs @@ -31,7 +31,11 @@ using Quaternion = global::OpenTK.Quaternion; using MathHelper = global::OpenTK.MathHelper; #if MONOMAC +#if NET +using pfloat = ObjCRuntime.nfloat; +#else using pfloat = System.nfloat; +#endif #else using pfloat = System.Single; #endif diff --git a/src/SceneKit/SCNVector3.cs b/src/SceneKit/SCNVector3.cs index 4a50c6e051..c4a11fffb6 100644 --- a/src/SceneKit/SCNVector3.cs +++ b/src/SceneKit/SCNVector3.cs @@ -34,7 +34,11 @@ using Vector2 = global::OpenTK.Vector2; using Vector3 = global::OpenTK.Vector3; using MathHelper = global::OpenTK.MathHelper; #if MONOMAC +#if NET +using pfloat = ObjCRuntime.nfloat; +#else using pfloat = System.nfloat; +#endif #else using pfloat = System.Single; #endif diff --git a/src/SceneKit/SCNVector4.cs b/src/SceneKit/SCNVector4.cs index ddd5fd440b..92dd3a27c2 100644 --- a/src/SceneKit/SCNVector4.cs +++ b/src/SceneKit/SCNVector4.cs @@ -34,7 +34,11 @@ using Vector4 = global::OpenTK.Vector4; using Quaternion = global::OpenTK.Quaternion; using MathHelper = global::OpenTK.MathHelper; #if MONOMAC +#if NET +using pfloat = ObjCRuntime.nfloat; +#else using pfloat = System.nfloat; +#endif #else using pfloat = System.Single; #endif diff --git a/src/UIKit/Compat.cs b/src/UIKit/Compat.cs index 6c3f7ea303..1762429bb8 100644 --- a/src/UIKit/Compat.cs +++ b/src/UIKit/Compat.cs @@ -11,6 +11,7 @@ using System; using CoreGraphics; using Foundation; +using ObjCRuntime; namespace UIKit { diff --git a/src/UIKit/UIStringDrawing.cs b/src/UIKit/UIStringDrawing.cs index 1680c4a2fb..0511df45c0 100644 --- a/src/UIKit/UIStringDrawing.cs +++ b/src/UIKit/UIStringDrawing.cs @@ -28,7 +28,7 @@ namespace UIKit { [UnsupportedOSPlatform ("ios7.0")] [Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif - public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, UILineBreakMode breakMode) + public static CGSize DrawString (this string This, CGPoint point, nfloat width, UIFont font, UILineBreakMode breakMode) { using (var self = ((NSString) This)) return self.DrawString (point, width, font, breakMode); @@ -40,7 +40,7 @@ namespace UIKit { [UnsupportedOSPlatform ("ios7.0")] [Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif - public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, global::System.nfloat fontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment) + public static CGSize DrawString (this string This, CGPoint point, nfloat width, UIFont font, nfloat fontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment) { using (var self = ((NSString) This)) return self.DrawString (point, width, font, fontSize, breakMode, adjustment); @@ -52,7 +52,7 @@ namespace UIKit { [UnsupportedOSPlatform ("ios7.0")] [Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif - public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, global::System.nfloat minFontSize, ref global::System.nfloat actualFontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment) + public static CGSize DrawString (this string This, CGPoint point, nfloat width, UIFont font, nfloat minFontSize, ref nfloat actualFontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment) { using (var self = ((NSString) This)) return self.DrawString (point, width, font, minFontSize, ref actualFontSize, breakMode, adjustment); @@ -112,7 +112,7 @@ namespace UIKit { [UnsupportedOSPlatform ("ios7.0")] [Obsolete ("Starting with ios7.0 use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif - public static CGSize StringSize (this string This, UIFont font, global::System.nfloat forWidth, UILineBreakMode breakMode) + public static CGSize StringSize (this string This, UIFont font, nfloat forWidth, UILineBreakMode breakMode) { using (var self = ((NSString) This)) return self.StringSize (font, forWidth, breakMode); @@ -147,7 +147,7 @@ namespace UIKit { #else [UnsupportedOSPlatform ("ios7.0")] #endif - public static CGSize StringSize (this string This, UIFont font, global::System.nfloat minFontSize, ref global::System.nfloat actualFontSize, global::System.nfloat forWidth, UILineBreakMode lineBreakMode) + public static CGSize StringSize (this string This, UIFont font, nfloat minFontSize, ref nfloat actualFontSize, nfloat forWidth, UILineBreakMode lineBreakMode) { using (var self = ((NSString) This)) return self.StringSize (font, minFontSize, ref actualFontSize, forWidth, lineBreakMode); diff --git a/src/WKWebKit/WKWindowFeatures.cs b/src/WKWebKit/WKWindowFeatures.cs index 4e5abd3893..a8ab6614da 100644 --- a/src/WKWebKit/WKWindowFeatures.cs +++ b/src/WKWebKit/WKWindowFeatures.cs @@ -10,6 +10,7 @@ using System; using Foundation; +using ObjCRuntime; #nullable enable diff --git a/src/generator-typemanager.cs b/src/generator-typemanager.cs index 69a9571d89..2431b0d963 100644 --- a/src/generator-typemanager.cs +++ b/src/generator-typemanager.cs @@ -191,7 +191,11 @@ public class TypeManager { System_nint = Lookup (platform_assembly, "System", "nint"); System_nuint = Lookup (platform_assembly, "System", "nuint"); +#if NET + System_nfloat = Lookup (platform_assembly, "ObjCRuntime", "nfloat"); +#else System_nfloat = Lookup (platform_assembly, "System", "nfloat"); +#endif /* fundamental */ NSObject = Lookup (platform_assembly, "Foundation", "NSObject"); diff --git a/src/glkit.cs b/src/glkit.cs index 4b66918178..2331384ecb 100644 --- a/src/glkit.cs +++ b/src/glkit.cs @@ -43,7 +43,11 @@ using Quaternion = global::OpenTK.Quaternion; using MathHelper = global::OpenTK.MathHelper; #if MONOMAC +#if NET +using pfloat = ObjCRuntime.nfloat; +#else using pfloat = System.nfloat; +#endif using AppKit; #else using OpenGLES; diff --git a/src/spritekit.cs b/src/spritekit.cs index bf4881fc94..9c6f80570c 100644 --- a/src/spritekit.cs +++ b/src/spritekit.cs @@ -42,7 +42,11 @@ using AppKit; using UIColor = global::AppKit.NSColor; using UIImage = global::AppKit.NSImage; using UIView = global::AppKit.NSView; +#if NET +using pfloat = ObjCRuntime.nfloat; +#else using pfloat = System.nfloat; +#endif #else using UIKit; using NSLineBreakMode = global::UIKit.UILineBreakMode; diff --git a/tests/generator/GeneratorTests.cs b/tests/generator/GeneratorTests.cs index 0ab3d42544..a97d0bc66e 100644 --- a/tests/generator/GeneratorTests.cs +++ b/tests/generator/GeneratorTests.cs @@ -1,10 +1,13 @@ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using NUnit.Framework; using Xamarin; using Xamarin.Tests; +using Xamarin.Utils; namespace GeneratorTests { @@ -18,7 +21,20 @@ namespace GeneratorTests var bgen = new BGenTool (); bgen.CreateTemporaryBinding (""); bgen.ResponseFile = Path.Combine (Cache.CreateTemporaryDirectory (), "rspfile"); - File.WriteAllLines (bgen.ResponseFile, new string [] { "--target-framework:Xamarin.iOS,v1.0" }); + + var arguments = new List (); +#if NET + var targetFramework = TargetFramework.DotNet_6_0_iOS_String; + var tf = TargetFramework.Parse (targetFramework); + arguments.Add ($"--baselib={Configuration.GetBaseLibrary (tf)}"); + arguments.Add ($"--attributelib={Configuration.GetBindingAttributePath (tf)}"); + arguments.AddRange (Directory.GetFiles (Configuration.DotNet6BclDir, "*.dll").Select (v => $"-r:{v}")); +#else + var targetFramework = "Xamarin.iOS,v1.0"; +#endif + arguments.Add ($"--target-framework={targetFramework}"); + + File.WriteAllLines (bgen.ResponseFile, arguments.ToArray ()); bgen.AssertExecute ("response file"); bgen.AssertNoWarnings (); } diff --git a/tests/introspection/ApiSignatureTest.cs b/tests/introspection/ApiSignatureTest.cs index 19b7a9f3ab..1687866c89 100644 --- a/tests/introspection/ApiSignatureTest.cs +++ b/tests/introspection/ApiSignatureTest.cs @@ -33,7 +33,11 @@ using ObjCRuntime; namespace Introspection { public abstract class ApiSignatureTest : ApiBaseTest { - +#if NET + const string NFloatTypeName = "ObjCRuntime.nfloat"; +#else + const string NFloatTypeName = "System.nfloat"; +#endif [DllImport ("/usr/lib/libobjc.dylib")] // note: the returned string is not ours to free static extern IntPtr objc_getClass (string name); @@ -662,7 +666,7 @@ namespace Introspection { switch (type.FullName) { case "System.Double": return true; - case "System.nfloat": + case NFloatTypeName: return IntPtr.Size == 8; default: return false; @@ -671,7 +675,7 @@ namespace Introspection { switch (type.FullName) { case "System.Single": return true; - case "System.nfloat": + case NFloatTypeName: return IntPtr.Size == 4; default: return false; diff --git a/tests/monotouch-test/AVFoundation/UtilitiesTest.cs b/tests/monotouch-test/AVFoundation/UtilitiesTest.cs index 29ce6e665d..67cbf142ff 100644 --- a/tests/monotouch-test/AVFoundation/UtilitiesTest.cs +++ b/tests/monotouch-test/AVFoundation/UtilitiesTest.cs @@ -20,6 +20,7 @@ using AppKit; using UIKit; #endif using AVFoundation; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.AVFoundation { diff --git a/tests/monotouch-test/AppKit/NSColor.cs b/tests/monotouch-test/AppKit/NSColor.cs index 12578a7e5a..7589beaba2 100644 --- a/tests/monotouch-test/AppKit/NSColor.cs +++ b/tests/monotouch-test/AppKit/NSColor.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using AppKit; using Foundation; +using ObjCRuntime; namespace Xamarin.Mac.Tests { diff --git a/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs b/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs index 4fcbc803c8..320a2bb584 100644 --- a/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs +++ b/tests/monotouch-test/CoreGraphics/AffineTransformTest.cs @@ -13,6 +13,7 @@ using System.Drawing; using System.Runtime.InteropServices; using Foundation; using CoreGraphics; +using ObjCRuntime; using NUnit.Framework; diff --git a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs index e7b402e398..c83fb3a242 100644 --- a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs +++ b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs @@ -16,6 +16,7 @@ using AppKit; using UIKit; #endif using CoreGraphics; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.CoreGraphics { diff --git a/tests/monotouch-test/CoreGraphics/ContextTest.cs b/tests/monotouch-test/CoreGraphics/ContextTest.cs index 29e6df5dc7..5f84c97d74 100644 --- a/tests/monotouch-test/CoreGraphics/ContextTest.cs +++ b/tests/monotouch-test/CoreGraphics/ContextTest.cs @@ -11,6 +11,7 @@ using System; using System.Drawing; using Foundation; using CoreGraphics; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.CoreGraphics { diff --git a/tests/monotouch-test/CoreGraphics/FunctionTest.cs b/tests/monotouch-test/CoreGraphics/FunctionTest.cs index 27265ec734..a9d9b57ae4 100644 --- a/tests/monotouch-test/CoreGraphics/FunctionTest.cs +++ b/tests/monotouch-test/CoreGraphics/FunctionTest.cs @@ -13,6 +13,7 @@ using System.Drawing; using Foundation; using CoreGraphics; using UIKit; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.CoreGraphics { diff --git a/tests/monotouch-test/CoreGraphics/PDFArrayTest.cs b/tests/monotouch-test/CoreGraphics/PDFArrayTest.cs index 3a68fbd181..9b9345e334 100644 --- a/tests/monotouch-test/CoreGraphics/PDFArrayTest.cs +++ b/tests/monotouch-test/CoreGraphics/PDFArrayTest.cs @@ -10,6 +10,7 @@ using System; using Foundation; using CoreGraphics; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.CoreGraphics { diff --git a/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs b/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs index 86d86ae0a0..0049364392 100644 --- a/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs +++ b/tests/monotouch-test/CoreGraphics/PDFDocumentTest.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Text; using Foundation; using CoreGraphics; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.CoreGraphics { diff --git a/tests/monotouch-test/CoreGraphics/PDFObjectTest.cs b/tests/monotouch-test/CoreGraphics/PDFObjectTest.cs index d566ee5e99..a3c7a4bac3 100644 --- a/tests/monotouch-test/CoreGraphics/PDFObjectTest.cs +++ b/tests/monotouch-test/CoreGraphics/PDFObjectTest.cs @@ -10,6 +10,7 @@ using System; using Foundation; using CoreGraphics; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.CoreGraphics { diff --git a/tests/monotouch-test/CoreImage/CoreVectorTest.cs b/tests/monotouch-test/CoreImage/CoreVectorTest.cs index de0300c112..7f66228f5c 100644 --- a/tests/monotouch-test/CoreImage/CoreVectorTest.cs +++ b/tests/monotouch-test/CoreImage/CoreVectorTest.cs @@ -13,6 +13,7 @@ using System; using Foundation; using CoreImage; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.CoreImage { diff --git a/tests/monotouch-test/CoreText/CTParagraphStyleTests.cs b/tests/monotouch-test/CoreText/CTParagraphStyleTests.cs index c9d4c08533..410844a018 100644 --- a/tests/monotouch-test/CoreText/CTParagraphStyleTests.cs +++ b/tests/monotouch-test/CoreText/CTParagraphStyleTests.cs @@ -13,6 +13,7 @@ using System.Linq; using Foundation; using CoreText; +using ObjCRuntime; namespace MonoTouchFixtures.CoreText { diff --git a/tests/monotouch-test/CoreText/FontDescriptorTest.cs b/tests/monotouch-test/CoreText/FontDescriptorTest.cs index 81d0ca0b58..e25793e1be 100644 --- a/tests/monotouch-test/CoreText/FontDescriptorTest.cs +++ b/tests/monotouch-test/CoreText/FontDescriptorTest.cs @@ -15,6 +15,7 @@ using AppKit; #else using UIKit; #endif +using ObjCRuntime; using NUnit.Framework; using System.Linq; diff --git a/tests/monotouch-test/UIKit/ColorTest.cs b/tests/monotouch-test/UIKit/ColorTest.cs index 3c5995f30b..d83e64a553 100644 --- a/tests/monotouch-test/UIKit/ColorTest.cs +++ b/tests/monotouch-test/UIKit/ColorTest.cs @@ -8,6 +8,7 @@ using System.Drawing; #endif using Foundation; using UIKit; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.UIKit { diff --git a/tests/monotouch-test/UIKit/EdgeInsetsTest.cs b/tests/monotouch-test/UIKit/EdgeInsetsTest.cs index ac19b7281a..ff96b753d8 100644 --- a/tests/monotouch-test/UIKit/EdgeInsetsTest.cs +++ b/tests/monotouch-test/UIKit/EdgeInsetsTest.cs @@ -13,6 +13,7 @@ using System.Drawing; using CoreGraphics; using Foundation; using UIKit; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.UIKit { diff --git a/tests/monotouch-test/UIKit/FontTest.cs b/tests/monotouch-test/UIKit/FontTest.cs index 44146c1697..91fe6fc16f 100644 --- a/tests/monotouch-test/UIKit/FontTest.cs +++ b/tests/monotouch-test/UIKit/FontTest.cs @@ -5,6 +5,7 @@ using System; using System.Drawing; using Foundation; using UIKit; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.UIKit { diff --git a/tests/monotouch-test/UIKit/GraphicsRendererTest.cs b/tests/monotouch-test/UIKit/GraphicsRendererTest.cs index 2389a6b5b2..82f8c2a2b5 100644 --- a/tests/monotouch-test/UIKit/GraphicsRendererTest.cs +++ b/tests/monotouch-test/UIKit/GraphicsRendererTest.cs @@ -12,6 +12,7 @@ using System; using Foundation; using UIKit; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.UIKit { diff --git a/tests/monotouch-test/UIKit/TableViewCellTest.cs b/tests/monotouch-test/UIKit/TableViewCellTest.cs index f2102a9f1e..dfd529421d 100644 --- a/tests/monotouch-test/UIKit/TableViewCellTest.cs +++ b/tests/monotouch-test/UIKit/TableViewCellTest.cs @@ -7,6 +7,7 @@ using System.Drawing; using CoreGraphics; using Foundation; using UIKit; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.UIKit { diff --git a/tests/monotouch-test/UIKit/WindowTest.cs b/tests/monotouch-test/UIKit/WindowTest.cs index 1affe91cba..9dad0dbdc7 100644 --- a/tests/monotouch-test/UIKit/WindowTest.cs +++ b/tests/monotouch-test/UIKit/WindowTest.cs @@ -7,6 +7,7 @@ using System.Drawing; using CoreGraphics; using Foundation; using UIKit; +using ObjCRuntime; using NUnit.Framework; namespace MonoTouchFixtures.UIKit { diff --git a/tests/xharness/Jenkins/Jenkins.cs b/tests/xharness/Jenkins/Jenkins.cs index 0f5fa46ed7..cd5163e800 100644 --- a/tests/xharness/Jenkins/Jenkins.cs +++ b/tests/xharness/Jenkins/Jenkins.cs @@ -225,7 +225,7 @@ namespace Xharness.Jenkins { TestProject = buildDotNetTestsProject, Platform = TestPlatform.All, TestName = "DotNet tests", - Timeout = TimeSpan.FromMinutes (90), + Timeout = TimeSpan.FromMinutes (120), Ignored = !IncludeDotNet, }; Tasks.Add (runDotNetTests); diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index b8e7618d7f..27f0d04ece 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -213,6 +213,8 @@ namespace Registrar { class StaticRegistrar : Registrar { + static string NFloatTypeName { get => Driver.IsDotNet ? "ObjCRuntime.nfloat" : "System.nfloat"; } + Dictionary protocol_member_method_map; public Dictionary ProtocolMemberMethodMap { @@ -730,10 +732,11 @@ namespace Registrar { case "System.Int64": case "System.UInt64": return 8; case "System.IntPtr": - case "System.nfloat": case "System.nuint": case "System.nint": return is_64_bits ? 8 : 4; default: + if (type.FullName == NFloatTypeName) + return is_64_bits ? 8 : 4; int size = 0; foreach (FieldDefinition field in type.Fields) { if (field.IsStatic) @@ -2449,14 +2452,15 @@ namespace Registrar { case "System.nuint": CheckNamespace ("Foundation", exceptions); return "NSUInteger"; - case "System.nfloat": - CheckNamespace ("CoreGraphics", exceptions); - return "CGFloat"; case "System.DateTime": throw ErrorHelper.CreateError (4102, Errors.MT4102, "System.DateTime", "Foundation.NSDate", descriptiveMethodName); case "ObjCRuntime.Selector": return "SEL"; case "ObjCRuntime.Class": return "Class"; default: + if (type.FullName == NFloatTypeName) { + CheckNamespace ("CoreGraphics", exceptions); + return "CGFloat"; + } TypeDefinition td = ResolveType (type); if (IsNSObject (td)) { if (!IsPlatformType (td)) @@ -2510,10 +2514,11 @@ namespace Registrar { case "System.UInt64": return "llu"; case "System.nint": return "zd"; case "System.nuint": return "tu"; - case "System.nfloat": case "System.Single": case "System.Double": return "f"; default: + if (type.FullName == NFloatTypeName) + return "f"; unknown = true; return "p"; } @@ -4397,9 +4402,10 @@ namespace Registrar { case "System.nuint": return "xamarin_nuint_to_nsnumber"; case "System.Single": return "xamarin_float_to_nsnumber"; case "System.Double": return "xamarin_double_to_nsnumber"; - case "System.nfloat": return "xamarin_nfloat_to_nsnumber"; case "System.Boolean": return "xamarin_bool_to_nsnumber"; default: + if (typeName == NFloatTypeName) + return "xamarin_nfloat_to_nsnumber"; if (IsEnum (managedType)) return GetManagedToNSNumberFunc (GetEnumUnderlyingType (managedType), inputType, outputType, descriptiveMethodName); throw ErrorHelper.CreateError (99, Errors.MX0099, $"can't convert from '{inputType.FullName}' to '{outputType.FullName}' in {descriptiveMethodName}"); @@ -4422,9 +4428,12 @@ namespace Registrar { case "System.nuint": nativeType = "NSUInteger"; return "xamarin_nsnumber_to_nuint"; case "System.Single": nativeType = "float"; return "xamarin_nsnumber_to_float"; case "System.Double": nativeType = "double"; return "xamarin_nsnumber_to_double"; - case "System.nfloat": nativeType = "CGFloat"; return "xamarin_nsnumber_to_nfloat"; case "System.Boolean": nativeType = "BOOL"; return "xamarin_nsnumber_to_bool"; default: + if (typeName == NFloatTypeName) { + nativeType = "CGFloat"; + return "xamarin_nsnumber_to_nfloat"; + } if (IsEnum (managedType)) return GetNSNumberToManagedFunc (GetEnumUnderlyingType (managedType), inputType, outputType, descriptiveMethodName, out nativeType); throw ErrorHelper.CreateError (99, Errors.MX0099, $"can't convert from '{inputType.FullName}' to '{outputType.FullName}' in {descriptiveMethodName}");