diff --git a/Localize/loc/cs/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/cs/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 46be5d72263a..b760cb8e21b8 100644
--- a/Localize/loc/cs/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/cs/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/de/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/de/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 3e5a8987936d..9d45f4e32d2c 100644
--- a/Localize/loc/de/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/de/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/es/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/es/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index adbfe1a6d661..7aa97f8c3c95 100644
--- a/Localize/loc/es/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/es/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/fr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/fr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index cde34370fe2e..4a34998fafa1 100644
--- a/Localize/loc/fr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/fr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/it/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/it/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 3313dd1017e2..f3db41c76334 100644
--- a/Localize/loc/it/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/it/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/ja/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/ja/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 31b9859eb460..4325fbaa9433 100644
--- a/Localize/loc/ja/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/ja/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/ko/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/ko/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 6734543dbcd5..fafc6adc50b0 100644
--- a/Localize/loc/ko/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/ko/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/pl/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/pl/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 418883dbb9cd..f2112d75beea 100644
--- a/Localize/loc/pl/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/pl/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/pt-BR/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/pt-BR/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 4982fb455f05..99e16554b08f 100644
--- a/Localize/loc/pt-BR/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/pt-BR/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/ru/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/ru/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 3dbdf753026a..99fa80f3b7bc 100644
--- a/Localize/loc/ru/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/ru/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/tr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/tr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index bcdb51d10439..107e4c7a159b 100644
--- a/Localize/loc/tr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/tr/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/zh-Hans/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/zh-Hans/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 8d51e358425d..fb59fe1f92f5 100644
--- a/Localize/loc/zh-Hans/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/zh-Hans/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Localize/loc/zh-Hant/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl b/Localize/loc/zh-Hant/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
index 90b1c847ac11..1833dcb8e6a7 100644
--- a/Localize/loc/zh-Hant/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
+++ b/Localize/loc/zh-Hant/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl
@@ -1816,6 +1816,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -2412,9 +2421,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
diff --git a/Make.config b/Make.config
index 9d7b6391fd5c..0289ed80e78f 100644
--- a/Make.config
+++ b/Make.config
@@ -38,10 +38,10 @@ include $(TOP)/Make.versions
APIDIFF_REFERENCES_iOS=https://bosstoragemirror.blob.core.windows.net/wrench/xcode13.1/8fd9e62891f8e4fbaa040cdfbf8b96467060c85c/5371501/package/bundle.zip
APIDIFF_REFERENCES_Mac=https://bosstoragemirror.blob.core.windows.net/wrench/xcode13.1/8fd9e62891f8e4fbaa040cdfbf8b96467060c85c/5371501/package/bundle.zip
-APIDIFF_REFERENCES_DOTNET_iOS=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx-rc1/9f2735684cbb390bb4fd98171e473e2d875d0627/5970061/package/bundle.zip
-APIDIFF_REFERENCES_DOTNET_tvOS=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx-rc1/9f2735684cbb390bb4fd98171e473e2d875d0627/5970061/package/bundle.zip
-APIDIFF_REFERENCES_DOTNET_macOS=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx-rc1/9f2735684cbb390bb4fd98171e473e2d875d0627/5970061/package/bundle.zip
-APIDIFF_REFERENCES_DOTNET_MacCatalyst=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx-rc1/9f2735684cbb390bb4fd98171e473e2d875d0627/5970061/package/bundle.zip
+APIDIFF_REFERENCES_DOTNET_iOS=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx/3f73ae00b1c49501673f56bcf6359f4eafc14bd2/6103038/package/bundle.zip
+APIDIFF_REFERENCES_DOTNET_tvOS=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx/3f73ae00b1c49501673f56bcf6359f4eafc14bd2/6103038/package/bundle.zip
+APIDIFF_REFERENCES_DOTNET_macOS=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx/3f73ae00b1c49501673f56bcf6359f4eafc14bd2/6103038/package/bundle.zip
+APIDIFF_REFERENCES_DOTNET_MacCatalyst=https://bosstoragemirror.blob.core.windows.net/wrench/6.0.3xx/3f73ae00b1c49501673f56bcf6359f4eafc14bd2/6103038/package/bundle.zip
PACKAGE_HEAD_REV=$(shell git rev-parse HEAD)
diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets
index f20e4a4e5cda..b8a19b2cc698 100644
--- a/dotnet/targets/Xamarin.Shared.Sdk.targets
+++ b/dotnet/targets/Xamarin.Shared.Sdk.targets
@@ -871,7 +871,7 @@
<_RunAotCompiler Condition="'$(_SdkIsSimulator)' != 'true' And '$(_PlatformName)' != 'macOS' And '$(_PlatformName)' != 'MacCatalyst'">true
- <_RunAotCompiler Condition="'$(MtouchInterpreter)' != ''">true
+ <_RunAotCompiler Condition="'$(MtouchInterpreter)' != '' And '$(_PlatformName)' != 'macOS'">true
<_RunAotCompiler Condition="'$(RuntimeIdentifier)' == 'maccatalyst-arm64'">true
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index efd69bce569d..4ec4f5f08d2b 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -1,8 +1,8 @@
-
+
https://github.com/dotnet/installer
- 20e198c744e733156888fd23344d47ca9320be6f
+ 49c376098d0e3312475c0fd88a19bdedba1579c0
https://github.com/dotnet/linker
diff --git a/eng/Versions.props b/eng/Versions.props
index 6687614a0079..89d59169e652 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -1,7 +1,7 @@
- 6.0.300-rtm.22220.25
+ 6.0.301-rtm.22253.26
6.0.200-1.22178.2
6.0.0-beta.21212.6
6.0.0-rc.2.21468.3
diff --git a/mk/xamarin.mk b/mk/xamarin.mk
index f0c1d1b9ba20..f766adf643ad 100644
--- a/mk/xamarin.mk
+++ b/mk/xamarin.mk
@@ -7,7 +7,7 @@ MONO_BRANCH := $(shell cd $(MONO_PATH) 2> /dev/null && git symbolic-ref --sho
endif
ifdef ENABLE_XAMARIN
-NEEDED_MACCORE_VERSION := cf9f7409e9a79d0d0835863cc9f5afe77ba5e74a
+NEEDED_MACCORE_VERSION := 749e84cb162b945dafa85fd6dffe80a727a491cf
NEEDED_MACCORE_BRANCH := main
MACCORE_DIRECTORY := maccore
diff --git a/src/QuickLook/Thumbnail.cs b/src/QuickLook/Thumbnail.cs
index 5883ec122df2..4b47ad9f6a6a 100644
--- a/src/QuickLook/Thumbnail.cs
+++ b/src/QuickLook/Thumbnail.cs
@@ -26,7 +26,10 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#nullable enable
+
#if MONOMAC
+
using System;
using System.Runtime.InteropServices;
@@ -43,12 +46,12 @@ public static partial class QLThumbnailImage {
[DllImport(Constants.QuickLookLibrary)]
extern static /* CGImageRef */ IntPtr QLThumbnailImageCreate (/* CFAllocatorRef */ IntPtr allocator, /* CFUrlRef */ IntPtr url, CGSize maxThumbnailSize, /* CFDictionaryRef */ IntPtr options);
- public static CGImage Create (NSUrl url, CGSize maxThumbnailSize, float scaleFactor = 1, bool iconMode = false)
+ public static CGImage? Create (NSUrl url, CGSize maxThumbnailSize, float scaleFactor = 1, bool iconMode = false)
{
- if (url == null)
- throw new ArgumentNullException ("url");
+ if (url is null)
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
- NSMutableDictionary dictionary = null;
+ NSMutableDictionary? dictionary = null;
if (scaleFactor != 1 && iconMode != false) {
dictionary = new NSMutableDictionary ();
@@ -56,7 +59,7 @@ public static CGImage Create (NSUrl url, CGSize maxThumbnailSize, float scaleFac
dictionary.LowlevelSetObject (iconMode ? CFBoolean.TrueHandle : CFBoolean.FalseHandle, OptionIconModeKey.Handle);
}
- var handle = QLThumbnailImageCreate (IntPtr.Zero, url.Handle, maxThumbnailSize, dictionary == null ? IntPtr.Zero : dictionary.Handle);
+ var handle = QLThumbnailImageCreate (IntPtr.Zero, url.Handle, maxThumbnailSize, dictionary.GetHandle ());
GC.KeepAlive (dictionary);
if (handle != IntPtr.Zero)
return new CGImage (handle, true);
diff --git a/src/SceneKit/SCNAnimatable.cs b/src/SceneKit/SCNAnimatable.cs
index 41b3c1447fe8..fd54182fb319 100644
--- a/src/SceneKit/SCNAnimatable.cs
+++ b/src/SceneKit/SCNAnimatable.cs
@@ -22,7 +22,7 @@ public partial class SCNAnimatable {
public void AddAnimation (CAAnimation animation, string? key = null)
{
- var nskey = key == null ? null : new NSString (key);
+ var nskey = key is null ? null : new NSString (key);
AddAnimation (animation, nskey);
nskey?.Dispose ();
diff --git a/src/SceneKit/SCNCompat.cs b/src/SceneKit/SCNCompat.cs
index fa700f9e2d72..68c61810f7f2 100644
--- a/src/SceneKit/SCNCompat.cs
+++ b/src/SceneKit/SCNCompat.cs
@@ -22,7 +22,7 @@ partial class SCNAction {
[Obsolete ("Use 'TimingFunction2' property.")]
public virtual Action? TimingFunction {
get {
- if (TimingFunction2 == null)
+ if (TimingFunction2 is null)
return null;
else
return (f) => {
@@ -30,7 +30,7 @@ public virtual Action? TimingFunction {
};
}
set {
- if (value == null)
+ if (value is null)
TimingFunction2 = null;
else
TimingFunction2 = (f) => {
@@ -76,7 +76,7 @@ partial class SCNScene {
[Mac (10, 9)]
public virtual bool WriteToUrl (NSUrl url, SCNSceneLoadingOptions options, SCNSceneExportDelegate handler, SCNSceneExportProgressHandler exportProgressHandler)
{
- return WriteToUrl (url: url, options: options == null ? null : options.Dictionary, aDelegate: handler, exportProgressHandler: exportProgressHandler);
+ return WriteToUrl (url: url, options: options?.Dictionary, aDelegate: handler, exportProgressHandler: exportProgressHandler);
}
[Obsolete ("Use the 'ISCNSceneExportDelegate' overload instead.")]
@@ -134,7 +134,7 @@ static public partial class SCNAnimatableExtensions {
static public void AddAnimation (this ISCNAnimatable self, SCNAnimation animation, string key)
{
using (var ca = CAAnimation.FromSCNAnimation (animation))
- using (var st = key != null ? new NSString (key) : null)
+ using (var st = key is not null ? new NSString (key) : null)
self.AddAnimation (ca, st);
}
}
diff --git a/src/SceneKit/SCNGeometrySource.cs b/src/SceneKit/SCNGeometrySource.cs
index 0dad3751d389..368b878495f9 100644
--- a/src/SceneKit/SCNGeometrySource.cs
+++ b/src/SceneKit/SCNGeometrySource.cs
@@ -22,7 +22,7 @@ public partial class SCNGeometrySource {
public static unsafe SCNGeometrySource FromVertices (SCNVector3 [] vertices)
{
- if (vertices == null)
+ if (vertices is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (vertices));
fixed (SCNVector3 *ptr = &vertices [0])
@@ -31,7 +31,7 @@ public static unsafe SCNGeometrySource FromVertices (SCNVector3 [] vertices)
public static unsafe SCNGeometrySource FromNormals (SCNVector3 [] normals)
{
- if (normals == null)
+ if (normals is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (normals));
fixed (SCNVector3 *ptr = &normals[0])
@@ -40,7 +40,7 @@ public static unsafe SCNGeometrySource FromNormals (SCNVector3 [] normals)
public static unsafe SCNGeometrySource FromTextureCoordinates (CGPoint [] texcoords)
{
- if (texcoords == null)
+ if (texcoords is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (texcoords));
fixed (CGPoint *ptr = &texcoords[0])
diff --git a/src/SceneKit/SCNJavaScript.cs b/src/SceneKit/SCNJavaScript.cs
index 708a40125315..25c4aa5d1700 100644
--- a/src/SceneKit/SCNJavaScript.cs
+++ b/src/SceneKit/SCNJavaScript.cs
@@ -35,7 +35,7 @@ public static class SCNJavaScript
public static void ExportModule (JSContext context)
{
- if (context == null)
+ if (context is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (context));
SCNExportJavaScriptModule (context.Handle);
diff --git a/src/SceneKit/SCNNode.cs b/src/SceneKit/SCNNode.cs
index cd947f74a057..932f188d8420 100644
--- a/src/SceneKit/SCNNode.cs
+++ b/src/SceneKit/SCNNode.cs
@@ -30,7 +30,7 @@ public void Add (SCNNode node)
public void AddNodes (params SCNNode [] nodes)
{
- if (nodes == null)
+ if (nodes is null)
return;
foreach (var n in nodes)
AddChildNode (n);
@@ -50,7 +50,7 @@ IEnumerator IEnumerable.GetEnumerator ()
#if !WATCH
public void AddAnimation (CAAnimation animation, string? key)
{
- if (key == null) {
+ if (key is null) {
((ISCNAnimatable) this).AddAnimation (animation, (NSString?) null);
} else {
using (var s = new NSString (key))
diff --git a/src/SceneKit/SCNParticleSystem.cs b/src/SceneKit/SCNParticleSystem.cs
index 33e6641e9d2a..3c6d83182a16 100644
--- a/src/SceneKit/SCNParticleSystem.cs
+++ b/src/SceneKit/SCNParticleSystem.cs
@@ -43,7 +43,7 @@ public SCNPropertyControllers ()
internal void Set (NSString key, SCNParticlePropertyController? value)
{
- if (mutDict == null){
+ if (mutDict is null){
mutDict = new NSMutableDictionary (dict);
dict = mutDict;
}
@@ -183,7 +183,7 @@ public partial class SCNParticleSystem
public SCNPropertyControllers? PropertyControllers {
get {
var weak = WeakPropertyControllers;
- if (weak == null)
+ if (weak is null)
return null;
return new SCNPropertyControllers (weak);
}
diff --git a/src/SceneKit/SCNPhysicsShape.cs b/src/SceneKit/SCNPhysicsShape.cs
index 58907e3f5118..f5c772474a09 100644
--- a/src/SceneKit/SCNPhysicsShape.cs
+++ b/src/SceneKit/SCNPhysicsShape.cs
@@ -21,10 +21,10 @@ public partial class SCNPhysicsShape
{
public static SCNPhysicsShape Create (SCNPhysicsShape [] shapes, SCNMatrix4 [] transforms)
{
- if (shapes == null)
+ if (shapes is null)
ObjCRuntime.ThrowHelper.ThrowArgumentException (nameof (shapes));
- if (transforms == null)
+ if (transforms is null)
ObjCRuntime.ThrowHelper.ThrowArgumentException (nameof (transforms));
var t = new NSValue [transforms.Length];
@@ -38,10 +38,10 @@ public static SCNPhysicsShape Create (SCNPhysicsShape [] shapes, SCNMatrix4 [] t
[Obsolete ("Use the 'Create' method that takes a 'SCNMatrix4 []'.")]
public static SCNPhysicsShape Create (SCNPhysicsShape [] shapes, SCNVector3 [] transforms)
{
- if (shapes == null)
+ if (shapes is null)
ObjCRuntime.ThrowHelper.ThrowArgumentException (nameof (shapes));
- if (transforms == null)
+ if (transforms is null)
ObjCRuntime.ThrowHelper.ThrowArgumentException (nameof (transforms));
var t = new NSValue [transforms.Length];
@@ -89,7 +89,7 @@ public static SCNPhysicsShape Create (SCNNode node, SCNPhysicsShapeOptions? opti
public SCNPhysicsShapeOptions? Options {
get {
var o = _Options;
- if (o == null)
+ if (o is null)
return null;
return new SCNPhysicsShapeOptions (o);
}
@@ -116,7 +116,7 @@ public SCNPhysicsShapeOptions () {}
internal SCNPhysicsShapeOptions (NSDictionary source)
{
var ret = source [SCNPhysicsShapeOptionsKeys.Type] as NSString;
- if (ret != null){
+ if (ret is not null){
if (ret == SCNPhysicsShapeOptionsTypes.BoundingBox)
ShapeType = SCNPhysicsShapeType.BoundingBox;
else if (ret == SCNPhysicsShapeOptionsTypes.ConcavePolyhedron)
@@ -125,10 +125,10 @@ internal SCNPhysicsShapeOptions (NSDictionary source)
ShapeType = SCNPhysicsShapeType.ConvexHull;
}
var bret = source [SCNPhysicsShapeOptionsKeys.KeepAsCompound] as NSNumber;
- if (bret != null)
+ if (bret is not null)
KeepAsCompound = bret.Int32Value != 0;
var nret = source [SCNPhysicsShapeOptionsKeys.Scale] as NSValue;
- if (nret != null)
+ if (nret is not null)
Scale = nret.Vector3Value;
}
diff --git a/src/SceneKit/SCNRenderingOptions.cs b/src/SceneKit/SCNRenderingOptions.cs
index eec7162cba6a..4968b59563e1 100644
--- a/src/SceneKit/SCNRenderingOptions.cs
+++ b/src/SceneKit/SCNRenderingOptions.cs
@@ -11,7 +11,7 @@ public partial class SCNRenderingOptions {
public SCNRenderingApi? RenderingApi {
get {
var val = GetNUIntValue (SCNRenderingOptionsKeys.RenderingApiKey);
- if (val != null)
+ if (val is not null)
return (SCNRenderingApi)(uint) val;
return null;
}
diff --git a/src/SceneKit/SCNSkinner.cs b/src/SceneKit/SCNSkinner.cs
index f43bd308e9a2..d400fe4e7168 100644
--- a/src/SceneKit/SCNSkinner.cs
+++ b/src/SceneKit/SCNSkinner.cs
@@ -42,7 +42,7 @@ static NSArray ToNSArray (SCNMatrix4 []? items)
for (nint i = 0; i < count; i++) {
var item = NSValue.FromSCNMatrix4 (items [i]);
- var h = item == null ? NSNull.Null.Handle : item.Handle;
+ var h = item?.Handle ?? NSNull.Null.Handle;
Marshal.WriteIntPtr (buf, (int)(i * IntPtr.Size), h);
}
diff --git a/src/SearchKit/SearchKit.cs b/src/SearchKit/SearchKit.cs
index 198862c0b7a3..af31031cfb6e 100644
--- a/src/SearchKit/SearchKit.cs
+++ b/src/SearchKit/SearchKit.cs
@@ -64,7 +64,7 @@ internal SKSearch (NativeHandle handle, bool owns)
public bool FindMatches (nint maxCount, ref nint [] ids, double waitTime, out nint foundCount)
{
if (ids is null)
- throw new ArgumentNullException (nameof (ids));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (ids));
if (ids.Length == 0)
throw new ArgumentException ("ids should have at least one element");
if (ids.Length != maxCount)
@@ -80,7 +80,7 @@ public bool FindMatches (nint maxCount, ref nint [] ids, double waitTime, out ni
public bool FindMatches (nint maxCount, ref nint [] ids, ref float []? scores, double waitTime, out nint foundCount)
{
if (ids is null)
- throw new ArgumentNullException (nameof (ids));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (ids));
if (ids.Length == 0)
throw new ArgumentException ("ids should have at least one element");
if (ids.Length != maxCount)
@@ -126,7 +126,7 @@ public class SKDocument : NativeObject
static IntPtr Create (string name, SKDocument? parent = null, string? scheme = null)
{
if (name is null)
- throw new ArgumentNullException (nameof (name));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name));
var schemeHandle = CFString.CreateNative (scheme);
var nameHandle = CFString.CreateNative (name);
try {
@@ -220,7 +220,7 @@ public class SKIndex : NativeObject
public static SKIndex? CreateWithUrl (NSUrl url, string indexName, SKIndexType type, SKTextAnalysis analysisProperties)
{
if (url is null)
- throw new ArgumentNullException (nameof (url));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
var indexNameHandle = CFString.CreateNative (indexName);
try {
var handle = SKIndexCreateWithURL (url.Handle, indexNameHandle, type, analysisProperties.GetHandle ());
@@ -235,9 +235,9 @@ public class SKIndex : NativeObject
public static SKIndex? FromUrl (NSUrl url, string indexName, bool writeAccess)
{
if (url is null)
- throw new ArgumentNullException (nameof (url));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
if (indexName is null)
- throw new ArgumentNullException (nameof (indexName));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (indexName));
var indexNameHandle = CFString.CreateNative (indexName);
try {
var handle = SKIndexOpenWithURL (url.Handle, indexNameHandle, writeAccess);
@@ -252,9 +252,9 @@ public class SKIndex : NativeObject
public static SKIndex? CreateWithMutableData (NSMutableData data, string indexName, SKIndexType type, SKTextAnalysis analysisProperties)
{
if (data is null)
- throw new ArgumentNullException (nameof (data));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data));
if (indexName is null)
- throw new ArgumentNullException (nameof (indexName));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (indexName));
var indexNameHandle = CFString.CreateNative (indexName);
try {
var handle = SKIndexCreateWithMutableData (data.Handle, indexNameHandle, type, analysisProperties.GetHandle ());
@@ -269,9 +269,9 @@ public class SKIndex : NativeObject
public static SKIndex? FromMutableData (NSMutableData data, string indexName)
{
if (data is null)
- throw new ArgumentNullException (nameof (data));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data));
if (indexName is null)
- throw new ArgumentNullException (nameof (indexName));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (indexName));
var indexNameHandle = CFString.CreateNative (indexName);
try {
var handle = SKIndexOpenWithMutableData (data.Handle, indexNameHandle);
@@ -286,9 +286,9 @@ public class SKIndex : NativeObject
public static SKIndex? FromData (NSData data, string indexName)
{
if (data is null)
- throw new ArgumentNullException (nameof (data));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data));
if (indexName is null)
- throw new ArgumentNullException (nameof (indexName));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (indexName));
var indexNameHandle = CFString.CreateNative (indexName);
try {
var handle = SKIndexOpenWithData (data.Handle, indexNameHandle);
@@ -330,7 +330,7 @@ protected override void Dispose (bool disposing)
public bool AddDocumentWithText (SKDocument document, string text, bool canReplace)
{
if (document is null)
- throw new ArgumentNullException (nameof (document));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (document));
var textHandle = CFString.CreateNative (text);
try {
return SKIndexAddDocumentWithText (Handle, document.Handle, textHandle, canReplace);
@@ -346,7 +346,7 @@ public bool AddDocumentWithText (SKDocument document, string text, bool canRepla
public bool AddDocument (SKDocument document, string mimeHint, bool canReplace)
{
if (document is null)
- throw new ArgumentNullException (nameof (document));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (document));
var mimeHintHandle = CFString.CreateNative (mimeHint);
try {
return SKIndexAddDocument (Handle, document.Handle, mimeHintHandle, canReplace);
@@ -412,9 +412,9 @@ public SKTextAnalysis AnalysisProperties {
public bool MoveDocument (SKDocument document, SKDocument newParent)
{
if (document is null)
- throw new ArgumentNullException (nameof (document));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (document));
if (newParent is null)
- throw new ArgumentNullException (nameof (newParent));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (newParent));
return SKIndexMoveDocument (Handle, document.Handle, newParent.Handle);
}
@@ -426,7 +426,7 @@ public bool MoveDocument (SKDocument document, SKDocument newParent)
public bool RemoveDocument (SKDocument document)
{
if (document is null)
- throw new ArgumentNullException (nameof (document));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (document));
return SKIndexRemoveDocument (Handle, document.Handle);
}
@@ -437,9 +437,9 @@ public bool RemoveDocument (SKDocument document)
public bool RenameDocument (SKDocument document, string newName)
{
if (document is null)
- throw new ArgumentNullException (nameof (document));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (document));
if (newName is null)
- throw new ArgumentNullException (nameof (newName));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (newName));
var newNameHandle =CFString.CreateNative (newName);
try {
return SKIndexRenameDocument (Handle, document.Handle, newNameHandle);
@@ -470,7 +470,7 @@ public nint MaximumBytesBeforeFlush {
public SKSearch Search (string query, SKSearchOptions options = SKSearchOptions.Default)
{
if (query is null)
- throw new ArgumentNullException (nameof (query));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (query));
var queryHandle = CFString.CreateNative (query);
try {
return new SKSearch (SKSearchCreate (Handle, queryHandle, options), true);
@@ -495,9 +495,9 @@ public SKSearch Search (string query, SKSearchOptions options = SKSearchOptions.
public void SetDocumentProperties (SKDocument document, NSDictionary dict)
{
if (document is null)
- throw new ArgumentNullException (nameof (document));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (document));
if (dict is null)
- throw new ArgumentNullException (nameof (dict));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dict));
SKIndexSetDocumentProperties (Handle, document.Handle, dict.Handle);
}
}
@@ -519,7 +519,7 @@ internal SKSummary (NativeHandle handle, bool owns)
public static SKSummary? Create (string text)
{
if (text is null)
- throw new ArgumentNullException (nameof (text));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (text));
var x = CFString.CreateNative (text);
try {
var handle = SKSummaryCreateWithString (x);
@@ -534,7 +534,7 @@ internal SKSummary (NativeHandle handle, bool owns)
public static SKSummary? Create (NSString nsString)
{
if (nsString is null)
- throw new ArgumentNullException (nameof (nsString));
+ ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (nsString));
var h = SKSummaryCreateWithString (nsString.Handle);
if (h == IntPtr.Zero)
diff --git a/src/SensorKit/SRSensor.cs b/src/SensorKit/SRSensor.cs
index 70315d933697..e2651cf211a5 100644
--- a/src/SensorKit/SRSensor.cs
+++ b/src/SensorKit/SRSensor.cs
@@ -11,7 +11,7 @@ public partial class SRSensorExtensions {
public static SRSensor GetSensorForDeletionRecords (this SRSensor self)
{
var constant = self.GetConstant ();
- if (constant == null)
+ if (constant is null)
return SRSensor.Invalid;
return GetValue (constant._GetSensorForDeletionRecordsFromSensor ());
}
diff --git a/src/Social/SLCompat.cs b/src/Social/SLCompat.cs
index 1f5a60d2f036..169c66139d6b 100644
--- a/src/Social/SLCompat.cs
+++ b/src/Social/SLCompat.cs
@@ -1,5 +1,7 @@
// Copyright 2016 Xamarin Inc. All rights reserved.
+#nullable enable
+
#if !XAMCORE_3_0 && !MONOMAC
using System;
diff --git a/src/Social/SLComposeViewController.cs b/src/Social/SLComposeViewController.cs
index 6fb32d6707a1..320a257ee803 100644
--- a/src/Social/SLComposeViewController.cs
+++ b/src/Social/SLComposeViewController.cs
@@ -6,6 +6,9 @@
//
// Copyright 2012 Xamarin Inc
//
+
+#nullable enable
+
#if !MONOMAC
using System;
using ObjCRuntime;
diff --git a/src/Social/SLRequest.cs b/src/Social/SLRequest.cs
index 8d0a0ea8aa4f..e924e24a6c2a 100644
--- a/src/Social/SLRequest.cs
+++ b/src/Social/SLRequest.cs
@@ -7,6 +7,8 @@
// Copyright 2012-2013 Xamarin Inc
//
+#nullable enable
+
using System;
using ObjCRuntime;
using Foundation;
@@ -30,8 +32,9 @@ internal static NSString KindToType (SLServiceKind kind)
case SLServiceKind.LinkedIn:
return SLServiceType.LinkedIn;
#endif
+ default:
+ throw new ArgumentOutOfRangeException (nameof (kind));
}
- return null;
}
public static SLRequest Create (SLServiceKind serviceKind, SLRequestMethod method, NSUrl url, NSDictionary parameters)
diff --git a/src/SpriteKit/SKNode.cs b/src/SpriteKit/SKNode.cs
index bc49d8012fd1..da0f4b5e4077 100644
--- a/src/SpriteKit/SKNode.cs
+++ b/src/SpriteKit/SKNode.cs
@@ -48,7 +48,7 @@ public void Add (SKNode node)
public void AddNodes (params SKNode []? nodes)
{
- if (nodes == null)
+ if (nodes is null)
return;
foreach (var n in nodes)
AddChild (n);
@@ -79,9 +79,9 @@ IEnumerator IEnumerable.GetEnumerator ()
public static SKNode? Create (string filename, Type [] types, out NSError error)
{
// Let's fail early.
- if (filename == null)
+ if (filename is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (filename));
- if (types == null)
+ if (types is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (types));
if (types.Length == 0)
ObjCRuntime.ThrowHelper.ThrowArgumentException (nameof (types), "Length must be greater than zero.");
@@ -107,7 +107,7 @@ IEnumerator IEnumerable.GetEnumerator ()
public static SKNode? Create (string filename, NSSet classes, out NSError error)
{
// `filename` will be checked by `Create` later
- if (classes == null)
+ if (classes is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (classes));
if (classes.Count == 0)
ObjCRuntime.ThrowHelper.ThrowArgumentException (nameof (classes), "Length must be greater than zero.");
diff --git a/src/SpriteKit/SKShapeNode.cs b/src/SpriteKit/SKShapeNode.cs
index 649f0dd26374..25e80f7967a4 100644
--- a/src/SpriteKit/SKShapeNode.cs
+++ b/src/SpriteKit/SKShapeNode.cs
@@ -27,7 +27,7 @@ public partial class SKShapeNode : SKNode {
#endif
public static SKShapeNode FromPoints (CGPoint [] points)
{
- if (points == null)
+ if (points is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (points));
return FromPoints (ref points[0], (nuint) points.Length);
@@ -44,7 +44,7 @@ public static SKShapeNode FromPoints (CGPoint [] points)
#endif
public static SKShapeNode FromPoints (CGPoint [] points, int offset, int length)
{
- if (points == null)
+ if (points is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (points));
if (offset > points.Length - length)
throw new InvalidOperationException ("offset + length must not be greater than the length of the array");
@@ -63,7 +63,7 @@ public static SKShapeNode FromPoints (CGPoint [] points, int offset, int length)
#endif
public static SKShapeNode FromSplinePoints (CGPoint [] points)
{
- if (points == null)
+ if (points is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (points));
return FromSplinePoints (ref points[0], (nuint) points.Length);
@@ -80,7 +80,7 @@ public static SKShapeNode FromSplinePoints (CGPoint [] points)
#endif
public static SKShapeNode FromSplinePoints (CGPoint [] points, int offset, int length)
{
- if (points == null)
+ if (points is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (points));
if (offset > points.Length - length)
throw new InvalidOperationException ("offset + length must not be greater than the length of the array");
diff --git a/src/SpriteKit/SKWarpGeometryGrid.cs b/src/SpriteKit/SKWarpGeometryGrid.cs
index 9119c8c05c0c..70923e55a4b0 100644
--- a/src/SpriteKit/SKWarpGeometryGrid.cs
+++ b/src/SpriteKit/SKWarpGeometryGrid.cs
@@ -58,7 +58,7 @@ public unsafe SKWarpGeometryGrid (nint cols, nint rows, Vector2 [] sourcePositio
public unsafe SKWarpGeometryGrid GetGridByReplacingSourcePositions (Vector2 [] sourcePositions)
{
- if (sourcePositions == null)
+ if (sourcePositions is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (sourcePositions));
// TODO: Verify this assumption when/if doc is updated or headers changed in newer betas.
if (sourcePositions.Length < ((NumberOfColumns + 1) * (NumberOfRows + 1)))
@@ -70,7 +70,7 @@ public unsafe SKWarpGeometryGrid GetGridByReplacingSourcePositions (Vector2 [] s
public unsafe SKWarpGeometryGrid GetGridByReplacingDestPositions (Vector2 [] destPositions)
{
- if (destPositions == null)
+ if (destPositions is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (destPositions));
// TODO: Verify this assumption when/if doc is updated or headers changed in newer betas.
if (destPositions.Length < ((NumberOfColumns + 1) * (NumberOfRows + 1)))
diff --git a/src/System.ComponentModel/CancelEventArgs.cs b/src/System.ComponentModel/CancelEventArgs.cs
index 8743e68b8aa2..f18f514a36ef 100644
--- a/src/System.ComponentModel/CancelEventArgs.cs
+++ b/src/System.ComponentModel/CancelEventArgs.cs
@@ -27,6 +27,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#nullable enable
+
using System;
namespace System.ComponentModel {
diff --git a/tests/xharness/BCLTestImportTargetFactory.cs b/tests/xharness/BCLTestImportTargetFactory.cs
index 80a2241584d3..8db1a1484706 100644
--- a/tests/xharness/BCLTestImportTargetFactory.cs
+++ b/tests/xharness/BCLTestImportTargetFactory.cs
@@ -343,7 +343,7 @@ public List GetiOSBclTargets ()
foreach (var tp in projects) {
var prefix = tp.XUnit ? "xUnit" : "NUnit";
var finalName = tp.Name.StartsWith ("mscorlib", StringComparison.Ordinal) ? tp.Name : $"[{prefix}] Mono {tp.Name}"; // mscorlib is our special test
- var proj = new iOSTestProject (tp.Path) {
+ var proj = new iOSTestProject ("bcl", tp.Path) {
Name = finalName,
FailureMessage = tp.Failure,
RestoreNugetsInProject = true,
@@ -373,7 +373,7 @@ public List GetMacBclTargets (MacFlavors flavor)
foreach (var tp in GenerateAllMacTestProjects (platform)) {
var prefix = tp.XUnit ? "xUnit" : "NUnit";
var finalName = tp.Name.StartsWith ("mscorlib", StringComparison.Ordinal) ? tp.Name : $"[{prefix}] Mono {tp.Name}"; // mscorlib is our special test
- var proj = new MacTestProject (tp.Path, targetFrameworkFlavor: flavor) {
+ var proj = new MacTestProject ("bcl", tp.Path, targetFrameworkFlavor: flavor) {
Name = finalName,
Platform = "AnyCPU",
IsExecutableProject = true,
diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs
index 8ea1145b83d1..0e79d7a666f2 100644
--- a/tests/xharness/Harness.cs
+++ b/tests/xharness/Harness.cs
@@ -283,7 +283,7 @@ void AutoConfigureDotNet ()
var projectName = Path.GetFileName (projectPath);
var projExtension = projectInfo.IsFSharp ? ".fsproj" : ".csproj";
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "iOS", projectName + projExtension))) {
+ IOSTestProjects.Add (new iOSTestProject ("dotnet", Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "iOS", projectName + projExtension))) {
Name = projectName,
IsDotNetProject = true,
SkipiOSVariation = false,
@@ -296,7 +296,7 @@ void AutoConfigureDotNet ()
Configurations = projectInfo.Configurations,
});
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "tvOS", projectName + projExtension))) {
+ IOSTestProjects.Add (new iOSTestProject ("dotnet", Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "tvOS", projectName + projExtension))) {
Name = projectName,
IsDotNetProject = true,
SkipiOSVariation = true,
@@ -310,7 +310,7 @@ void AutoConfigureDotNet ()
Configurations = projectInfo.Configurations,
});
- MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "macOS", projectName + projExtension))) {
+ MacTestProjects.Add (new MacTestProject ("dotnet", Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "macOS", projectName + projExtension))) {
Name = projectName,
IsDotNetProject = true,
TargetFrameworkFlavors = MacFlavors.DotNet,
@@ -320,7 +320,7 @@ void AutoConfigureDotNet ()
Configurations = projectInfo.Configurations,
});
- MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "MacCatalyst", projectName + projExtension))) {
+ MacTestProjects.Add (new MacTestProject ("dotnet", Path.GetFullPath (Path.Combine (RootDirectory, projectPath, "dotnet", "MacCatalyst", projectName + projExtension))) {
Name = projectName,
IsDotNetProject = true,
TargetFrameworkFlavors = MacFlavors.MacCatalyst,
@@ -337,27 +337,27 @@ int AutoConfigureMac (bool generate_projects)
int rv = 0;
var test_suites = new [] {
- new { Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", Flavors = MacFlavors.Modern | MacFlavors.Full | MacFlavors.System },
+ new { Label = "linker", Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", Flavors = MacFlavors.Modern | MacFlavors.Full | MacFlavors.System },
};
foreach (var p in test_suites) {
- MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p.Directory, p.ProjectFile + ".csproj"))) {
+ MacTestProjects.Add (new MacTestProject (p.Label, Path.GetFullPath (Path.Combine (RootDirectory, p.Directory, p.ProjectFile + ".csproj"))) {
Name = p.Name,
TargetFrameworkFlavors = p.Flavors,
});
}
- MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "introspection" });
- MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "framework-test", "macOS", "framework-test-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "framework-test" });
- MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "xcframework-test", "macOS", "xcframework-test-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "xcframework-test" });
+ MacTestProjects.Add (new MacTestProject ("introspection", Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "introspection" });
+ MacTestProjects.Add (new MacTestProject ("framework-test", Path.GetFullPath (Path.Combine (RootDirectory, "framework-test", "macOS", "framework-test-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "framework-test" });
+ MacTestProjects.Add (new MacTestProject ("xcframework-test", Path.GetFullPath (Path.Combine (RootDirectory, "xcframework-test", "macOS", "xcframework-test-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "xcframework-test" });
var hard_coded_test_suites = new [] {
- new { Directory = "mmptest", ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[]) null, Platform = "x86", Flavors = MacFlavors.Console, },
- new { Directory = "xammac_tests", ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "AnyCPU", Flavors = MacFlavors.Modern, },
- new { Directory = "linker/mac/link all", ProjectFile = "link all-mac", Name = "link all", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
- new { Directory = "linker/mac/link sdk", ProjectFile = "link sdk-mac", Name = "link sdk", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
+ new { Label = "mmptest", Directory = "mmptest", ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[]) null, Platform = "x86", Flavors = MacFlavors.Console, },
+ new { Label = "xammac-tests", Directory = "xammac_tests", ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "AnyCPU", Flavors = MacFlavors.Modern, },
+ new { Label = "linker", Directory = "linker/mac/link all", ProjectFile = "link all-mac", Name = "link all", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
+ new { Label = "linker", Directory = "linker/mac/link sdk", ProjectFile = "link sdk-mac", Name = "link sdk", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
};
foreach (var p in hard_coded_test_suites) {
- MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p.Directory, p.ProjectFile + ".csproj")), targetFrameworkFlavor: p.Flavors) {
+ MacTestProjects.Add (new MacTestProject (p.Label, Path.GetFullPath (Path.Combine (RootDirectory, p.Directory, p.ProjectFile + ".csproj")), targetFrameworkFlavor: p.Flavors) {
Name = p.Name,
IsNUnitProject = p.IsNUnit,
SolutionPath = Path.GetFullPath (Path.Combine (RootDirectory, "tests-mac.sln")),
@@ -368,7 +368,7 @@ int AutoConfigureMac (bool generate_projects)
foreach (var flavor in new MonoNativeFlavor [] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified }) {
var monoNativeInfo = new MonoNativeInfo (DevicePlatform.macOS, flavor, RootDirectory, Log);
- var macTestProject = new MacTestProject (monoNativeInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full) {
+ var macTestProject = new MacTestProject ("mononative", monoNativeInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full) {
MonoNativeInfo = monoNativeInfo,
Name = monoNativeInfo.ProjectName,
Platform = "AnyCPU",
@@ -451,47 +451,47 @@ void AutoConfigureIOS ()
var fsharp_test_suites = new string [] { "fsharp" };
var fsharp_library_projects = new string [] { "fsharplibrary" };
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "monotouch-test", "monotouch-test.csproj"))) {
+ IOSTestProjects.Add (new iOSTestProject ("monotouch-test", Path.GetFullPath (Path.Combine (RootDirectory, "monotouch-test", "monotouch-test.csproj"))) {
Name = "monotouch-test",
});
foreach (var p in fsharp_test_suites)
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj"))) { Name = p });
+ IOSTestProjects.Add (new iOSTestProject ("fsharp", Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj"))) { Name = p });
foreach (var p in library_projects)
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".csproj")), false) { Name = p });
+ IOSTestProjects.Add (new iOSTestProject ("library-projects", Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".csproj")), false) { Name = p });
foreach (var p in fsharp_library_projects)
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj")), false) { Name = p });
+ IOSTestProjects.Add (new iOSTestProject ("fsharp", Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj")), false) { Name = p });
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "bindings-framework-test", "iOS", "bindings-framework-test.csproj")), false) {
+ IOSTestProjects.Add (new iOSTestProject ("bindings-framework-test", Path.GetFullPath (Path.Combine (RootDirectory, "bindings-framework-test", "iOS", "bindings-framework-test.csproj")), false) {
Name = "bindings-framework-test",
});
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "bindings-xcframework-test", "iOS", "bindings-xcframework-test.csproj")), false) {
+ IOSTestProjects.Add (new iOSTestProject ("bindings-xcframework-test", Path.GetFullPath (Path.Combine (RootDirectory, "bindings-xcframework-test", "iOS", "bindings-xcframework-test.csproj")), false) {
Name = "bindings-xcframework-test",
});
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "framework-test", "iOS", "framework-test-ios.csproj"))) {
+ IOSTestProjects.Add (new iOSTestProject ("framework-test", Path.GetFullPath (Path.Combine (RootDirectory, "framework-test", "iOS", "framework-test-ios.csproj"))) {
Name = "framework-test",
});
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "xcframework-test", "iOS", "xcframework-test-ios.csproj"))) {
+ IOSTestProjects.Add (new iOSTestProject ("xcframework-test", Path.GetFullPath (Path.Combine (RootDirectory, "xcframework-test", "iOS", "xcframework-test-ios.csproj"))) {
Name = "xcframework-test",
});
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "bindings-test", "iOS", "bindings-test.csproj")), false) { Name = "bindings-test" });
+ IOSTestProjects.Add (new iOSTestProject ("bindings-test", Path.GetFullPath (Path.Combine (RootDirectory, "bindings-test", "iOS", "bindings-test.csproj")), false) { Name = "bindings-test" });
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "interdependent-binding-projects", "interdependent-binding-projects.csproj"))) { Name = "interdependent-binding-projects" });
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "iOS", "introspection-ios.csproj"))) { Name = "introspection" });
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "dont link", "dont link.csproj"))) {
+ IOSTestProjects.Add (new iOSTestProject ("interdependent-binding-projects", Path.GetFullPath (Path.Combine (RootDirectory, "interdependent-binding-projects", "interdependent-binding-projects.csproj"))) { Name = "interdependent-binding-projects" });
+ IOSTestProjects.Add (new iOSTestProject ("introspection", Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "iOS", "introspection-ios.csproj"))) { Name = "introspection" });
+ IOSTestProjects.Add (new iOSTestProject ("linker", Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "dont link", "dont link.csproj"))) {
Configurations = new string [] { "Debug", "Release" },
});
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link all", "link all.csproj"))) {
+ IOSTestProjects.Add (new iOSTestProject ("linker", Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link all", "link all.csproj"))) {
Configurations = new string [] { "Debug", "Release" },
});
- IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link sdk", "link sdk.csproj"))) {
+ IOSTestProjects.Add (new iOSTestProject ("linker", Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link sdk", "link sdk.csproj"))) {
Configurations = new string [] { "Debug", "Release" },
});
foreach (var flavor in new MonoNativeFlavor [] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified }) {
var monoNativeInfo = new MonoNativeInfo (DevicePlatform.iOS, flavor, RootDirectory, Log);
- var iosTestProject = new iOSTestProject (monoNativeInfo.ProjectPath) {
+ var iosTestProject = new iOSTestProject ("mono-native", monoNativeInfo.ProjectPath) {
MonoNativeInfo = monoNativeInfo,
Name = monoNativeInfo.ProjectName,
SkipwatchOSARM64_32Variation = monoNativeInfo.ProjectName.Contains ("compat"),
diff --git a/tests/xharness/Jenkins/Jenkins.cs b/tests/xharness/Jenkins/Jenkins.cs
index a770d39539a4..9c1905c29bab 100644
--- a/tests/xharness/Jenkins/Jenkins.cs
+++ b/tests/xharness/Jenkins/Jenkins.cs
@@ -217,7 +217,7 @@ Task PopulateTasksAsync ()
};
Tasks.Add (runDotNetXtroReporter);
- var buildDotNetGeneratorProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "bgen", "bgen-tests.csproj"))) {
+ var buildDotNetGeneratorProject = new TestProject ("bgen", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "bgen", "bgen-tests.csproj"))) {
IsDotNetProject = true,
};
var buildDotNetGenerator = new MSBuildTask (jenkins: this, testProject: buildDotNetGeneratorProject, processManager: processManager) {
@@ -235,7 +235,7 @@ Task PopulateTasksAsync ()
};
Tasks.Add (runDotNetGenerator);
- var buildDotNetTestsProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "dotnet", "UnitTests", "DotNetUnitTests.csproj"))) {
+ var buildDotNetTestsProject = new TestProject ("dotnet", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "dotnet", "UnitTests", "DotNetUnitTests.csproj"))) {
IsDotNetProject = true,
};
var buildDotNetTests = new MSBuildTask (this, testProject: buildDotNetTestsProject, processManager: processManager) {
diff --git a/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs b/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs
index 4badf3d5925c..b15a1b45c974 100644
--- a/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs
+++ b/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs
@@ -19,7 +19,7 @@ public NUnitTestTasksEnumerable (Jenkins jenkins, IMlaunchProcessManager process
public IEnumerator GetEnumerator ()
{
- var netstandard2Project = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tasks.Tests", "Xamarin.MacDev.Tasks.Tests.csproj")));
+ var netstandard2Project = new TestProject ("msbuild", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tasks.Tests", "Xamarin.MacDev.Tasks.Tests.csproj")));
var buildiOSMSBuild = new MSBuildTask (jenkins: jenkins, testProject: netstandard2Project, processManager: processManager) {
SpecifyPlatform = false,
SpecifyConfiguration = true,
@@ -41,7 +41,7 @@ public IEnumerator GetEnumerator ()
};
yield return nunitExecutioniOSMSBuild;
- var msbuildIntegrationTestsProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tests", "Xamarin.MacDev.Tests.csproj")));
+ var msbuildIntegrationTestsProject = new TestProject ("msbuild", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tests", "Xamarin.MacDev.Tests.csproj")));
var buildiOSMSBuildIntegration = new MSBuildTask (jenkins: jenkins, testProject: msbuildIntegrationTestsProject, processManager: processManager) {
SpecifyPlatform = false,
SpecifyConfiguration = true,
@@ -63,7 +63,7 @@ public IEnumerator GetEnumerator ()
};
yield return nunitExecutioniOSMSBuildIntegration;
- var installSourcesProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "..", "tools", "install-source", "InstallSourcesTests", "InstallSourcesTests.csproj")));
+ var installSourcesProject = new TestProject ("install-source", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "..", "tools", "install-source", "InstallSourcesTests", "InstallSourcesTests.csproj")));
var buildInstallSources = new MSBuildTask (jenkins: jenkins, testProject: installSourcesProject, processManager: processManager) {
SpecifyPlatform = false,
SpecifyConfiguration = false,
@@ -82,7 +82,7 @@ public IEnumerator GetEnumerator ()
yield return nunitExecutionInstallSource;
var buildMTouch = new MakeTask (jenkins: jenkins, processManager: processManager) {
- TestProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "mtouchtests.sln"))),
+ TestProject = new TestProject ("mtouch", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "mtouchtests.sln"))),
SpecifyPlatform = false,
SpecifyConfiguration = false,
Platform = TestPlatform.iOS,
@@ -91,7 +91,7 @@ public IEnumerator GetEnumerator ()
};
var nunitExecutionMTouch = new NUnitExecuteTask (jenkins, buildMTouch, processManager) {
TestLibrary = Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "bin", "Debug", "mtouchtests.dll"),
- TestProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "mtouchtests.csproj"))),
+ TestProject = new TestProject ("mtouch", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "mtouchtests.csproj"))),
Platform = TestPlatform.iOS,
TestName = "MTouch tests",
Timeout = TimeSpan.FromMinutes (180),
@@ -101,7 +101,7 @@ public IEnumerator GetEnumerator ()
yield return nunitExecutionMTouch;
var buildGenerator = new MakeTask (jenkins: jenkins, processManager: processManager) {
- TestProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "..", "src", "generator.sln"))),
+ TestProject = new TestProject ("generator", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "..", "src", "generator.sln"))),
SpecifyPlatform = false,
SpecifyConfiguration = false,
Platform = TestPlatform.iOS,
@@ -110,7 +110,7 @@ public IEnumerator GetEnumerator ()
};
var runGenerator = new NUnitExecuteTask (jenkins, buildGenerator, processManager) {
TestLibrary = Path.Combine (HarnessConfiguration.RootDirectory, "generator", "bin", "Debug", "generator-tests.dll"),
- TestProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "generator", "generator-tests.csproj"))),
+ TestProject = new TestProject ("generator", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "generator", "generator-tests.csproj"))),
Platform = TestPlatform.iOS,
TestName = "Generator tests",
Mode = "NUnit",
@@ -119,7 +119,7 @@ public IEnumerator GetEnumerator ()
};
yield return runGenerator;
- var buildCecilTestsProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "cecil-tests", "cecil-tests.csproj")));
+ var buildCecilTestsProject = new TestProject ("cecil", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "cecil-tests", "cecil-tests.csproj")));
buildCecilTestsProject.RestoreNugetsInProject = true;
var buildCecilTests = new MSBuildTask (jenkins: jenkins, testProject: buildCecilTestsProject, processManager: processManager) {
SpecifyPlatform = false,
@@ -138,7 +138,7 @@ public IEnumerator GetEnumerator ()
};
yield return runCecilTests;
- var buildSampleTestsProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "sampletester", "sampletester.csproj")));
+ var buildSampleTestsProject = new TestProject ("sampletester", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "sampletester", "sampletester.csproj")));
var buildSampleTests = new MSBuildTask (jenkins: jenkins, testProject: buildSampleTestsProject, processManager: processManager) {
SpecifyPlatform = false,
Platform = TestPlatform.All,
@@ -146,7 +146,7 @@ public IEnumerator GetEnumerator ()
};
var runSampleTests = new NUnitExecuteTask (jenkins, buildSampleTests, processManager) {
TestLibrary = Path.Combine (HarnessConfiguration.RootDirectory, "sampletester", "bin", "Debug", "sampletester.dll"),
- TestProject = new TestProject (Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "sampletester", "sampletester.csproj"))),
+ TestProject = new TestProject ("sampletester", Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "sampletester", "sampletester.csproj"))),
Platform = TestPlatform.All,
TestName = "Sample tests",
Timeout = TimeSpan.FromDays (1), // These can take quite a while to execute.
diff --git a/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs b/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs
index 5b103b9f5843..f36ffb86c1e0 100644
--- a/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs
+++ b/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs
@@ -5,6 +5,8 @@
using System.Threading.Tasks;
using Microsoft.DotNet.XHarness.iOS.Shared;
+#nullable enable
+
namespace Xharness.Jenkins.TestTasks {
// This class groups simulator run tasks according to the
// simulator they'll run from, so that we minimize switching
@@ -14,11 +16,11 @@ class AggregatedRunSimulatorTask : AppleTestTask
public IEnumerable Tasks;
// Due to parallelization this isn't the same as the sum of the duration for all the build tasks.
- Stopwatch build_timer = new Stopwatch ();
- public TimeSpan BuildDuration { get { return build_timer.Elapsed; } }
+ readonly Stopwatch buildTimer = new ();
+ public TimeSpan BuildDuration { get { return buildTimer.Elapsed; } }
- Stopwatch run_timer = new Stopwatch ();
- public TimeSpan RunDuration { get { return run_timer.Elapsed; } }
+ readonly Stopwatch runTimer = new ();
+ public TimeSpan RunDuration { get { return runTimer.Elapsed; } }
public AggregatedRunSimulatorTask (Jenkins jenkins, IEnumerable tasks) : base (jenkins)
{
@@ -42,9 +44,9 @@ protected override async Task ExecuteAsync ()
// First build everything. This is required for the run simulator
// task to properly configure the simulator.
- build_timer.Start ();
+ buildTimer.Start ();
await Task.WhenAll (Tasks.Select ((v) => v.BuildAsync ()).Distinct ());
- build_timer.Stop ();
+ buildTimer.Stop ();
var executingTasks = Tasks.Where ((v) => !v.Ignored && !v.Failed);
if (!executingTasks.Any ()) {
@@ -53,7 +55,7 @@ protected override async Task ExecuteAsync ()
}
using (var desktop = await NotifyBlockingWaitAsync (ResourceManager.DesktopResource.AcquireExclusiveAsync ())) {
- run_timer.Start ();
+ runTimer.Start ();
// We need to set the dialog permissions for all the apps
// before launching the simulator, because once launched
@@ -68,7 +70,7 @@ protected override async Task ExecuteAsync ()
ExecutionResult = TestExecutingResult.DeviceNotFound;
return;
}
- Jenkins.MainLog.WriteLine ("Selected simulator: {0}", devices.Count() > 0 ? devices.First().Name : "none");
+ Jenkins.MainLog.WriteLine ("Selected simulator: {0}", devices.Any () ? devices.First().Name : "none");
foreach (var dev in devices) {
using var tcclog = Logs.Create ($"prepare-simulator-{Xharness.Harness.Helpers.Timestamp}.log", "Simulator preparation");
@@ -91,10 +93,10 @@ protected override async Task ExecuteAsync ()
await dev.Shutdown (Jenkins.MainLog);
var device = devices.FirstOrDefault ();
- if (device != null)
+ if (device is not null)
await device.KillEverything (Jenkins.MainLog);
- run_timer.Stop ();
+ runTimer.Stop ();
}
if (Tasks.All ((v) => v.Ignored)) {
diff --git a/tests/xharness/MacTestProject.cs b/tests/xharness/MacTestProject.cs
index 4d45eac71613..f05dd26045f4 100644
--- a/tests/xharness/MacTestProject.cs
+++ b/tests/xharness/MacTestProject.cs
@@ -32,14 +32,14 @@ public override bool GenerateVariations {
public string Platform = "x86";
- public MacTestProject (string path, bool isExecutableProject = true, MacFlavors targetFrameworkFlavor = MacFlavors.Full | MacFlavors.Modern) : base (path, isExecutableProject)
+ public MacTestProject (string label, string path, bool isExecutableProject = true, MacFlavors targetFrameworkFlavor = MacFlavors.Full | MacFlavors.Modern) : base (label, path, isExecutableProject)
{
TargetFrameworkFlavors = targetFrameworkFlavor;
}
public override TestProject Clone ()
{
- return CompleteClone (new MacTestProject (Path, IsExecutableProject, TargetFrameworkFlavors));
+ return CompleteClone (new MacTestProject (Label, Path, IsExecutableProject, TargetFrameworkFlavors));
}
protected override TestProject CompleteClone (TestProject project)
diff --git a/tests/xharness/Program.cs b/tests/xharness/Program.cs
index a9ea644fca97..9a8a2cdcca6b 100644
--- a/tests/xharness/Program.cs
+++ b/tests/xharness/Program.cs
@@ -43,26 +43,26 @@ public static int Main (string [] args)
{ "configure", "Creates project files and makefiles.", (v) => action = HarnessAction.Configure },
{ "autoconf", "Automatically decide what to configure.", (v) => configuration.AutoConf = true },
{ "rootdir=", "The root directory for the tests.", (v) => HarnessConfiguration.RootDirectory = v },
- { "project=", "Add a project file to process. This can be specified multiple times.", (v) => configuration.IOSTestProjects.Add (new iOSTestProject (v)) },
+ { "project=", "Add a project file to process. This can be specified multiple times.", (v) => configuration.IOSTestProjects.Add (new iOSTestProject (null, v)) },
{ "watchos-container-template=", "The directory to use as a template for a watchos container app.", (v) => configuration.WatchOSContainerTemplate = v },
{ "watchos-app-template=", "The directory to use as a template for a watchos app.", (v) => configuration.WatchOSAppTemplate = v },
// Run
{ "run=", "Executes a project.", (v) =>
{
action = HarnessAction.Run;
- configuration.IOSTestProjects.Add (new iOSTestProject (v));
+ configuration.IOSTestProjects.Add (new iOSTestProject (null, v));
}
},
{ "install=", "Installs a project.", (v) =>
{
action = HarnessAction.Install;
- configuration.IOSTestProjects.Add (new iOSTestProject (v));
+ configuration.IOSTestProjects.Add (new iOSTestProject (null, v));
}
},
{ "uninstall=", "Uninstalls a project.", (v) =>
{
action = HarnessAction.Uninstall;
- configuration.IOSTestProjects.Add (new iOSTestProject (v));
+ configuration.IOSTestProjects.Add (new iOSTestProject (null, v));
}
},
{ "sdkroot=", "Where Xcode is", (v) => configuration.SdkRoot = v },
diff --git a/tests/xharness/TestProject.cs b/tests/xharness/TestProject.cs
index 53c618ae9e30..baae5bd96eed 100644
--- a/tests/xharness/TestProject.cs
+++ b/tests/xharness/TestProject.cs
@@ -20,6 +20,7 @@ public class TestProject {
bool generate_variations = true;
public TestPlatform TestPlatform;
+ public string Label;
public string Path;
public string? SolutionPath;
public string? Name;
@@ -39,8 +40,9 @@ public class TestProject {
// Optional
public MonoNativeInfo? MonoNativeInfo { get; set; }
- public TestProject (string path, bool isExecutableProject = true)
+ public TestProject (string label, string path, bool isExecutableProject = true)
{
+ Label = label;
Path = path;
IsExecutableProject = isExecutableProject;
}
@@ -59,7 +61,7 @@ public XmlDocument Xml {
public virtual TestProject Clone ()
{
- return CompleteClone (new TestProject (Path, IsExecutableProject));
+ return CompleteClone (new TestProject (Label, Path, IsExecutableProject));
}
protected virtual TestProject CompleteClone (TestProject rv)
@@ -208,7 +210,7 @@ async Task CreateCopyAsync (ILog log, IProcessManager processManager, ITestTask
foreach (var pr in doc.GetProjectReferences ()) {
var prPath = pr.Replace ('\\', '/');
if (!allProjectReferences.TryGetValue (prPath, out var tp)) {
- tp = new TestProject (pr.Replace ('\\', '/'));
+ tp = new TestProject (Label, pr.Replace ('\\', '/'));
tp.TestPlatform = TestPlatform;
await tp.CreateCopyAsync (log, processManager, test, rootDirectory, allProjectReferences);
allProjectReferences.Add (prPath, tp);
diff --git a/tests/xharness/TestProjectExtensions.cs b/tests/xharness/TestProjectExtensions.cs
index 160c304c771f..89c698d9c150 100644
--- a/tests/xharness/TestProjectExtensions.cs
+++ b/tests/xharness/TestProjectExtensions.cs
@@ -52,7 +52,7 @@ public static TestProject GetTodayExtension (this TestProject self)
return null;
if (extensions.Count () != 1)
throw new NotImplementedException ();
- return new TestProject (Path.GetFullPath (Path.Combine (Path.GetDirectoryName (self.Path), Target.ProjectsDir, "today-extension", extensions.First ().Replace ('\\', '/'))));
+ return new TestProject (self.Label, Path.GetFullPath (Path.Combine (Path.GetDirectoryName (self.Path), Target.ProjectsDir, "today-extension", extensions.First ().Replace ('\\', '/'))));
}
}
}
diff --git a/tests/xharness/iOSTestProject.cs b/tests/xharness/iOSTestProject.cs
index f086d419e6ee..27a400cdcd4c 100644
--- a/tests/xharness/iOSTestProject.cs
+++ b/tests/xharness/iOSTestProject.cs
@@ -12,8 +12,8 @@ public class iOSTestProject : TestProject {
public bool SkipDeviceVariations;
public bool BuildOnly;
- public iOSTestProject (string path, bool isExecutableProject = true)
- : base (path, isExecutableProject)
+ public iOSTestProject (string label, string path, bool isExecutableProject = true)
+ : base (label, path, isExecutableProject)
{
Name = System.IO.Path.GetFileNameWithoutExtension (path);
}
@@ -28,7 +28,7 @@ public bool IsSupported (DevicePlatform devicePlatform, string productVersion)
public override TestProject Clone ()
{
- return CompleteClone (new iOSTestProject (Path, IsExecutableProject));
+ return CompleteClone (new iOSTestProject (Label, Path, IsExecutableProject));
}
protected override TestProject CompleteClone (TestProject project)
diff --git a/tools/nnyeah/nnyeah/AssemblyComparator/TypeAndMemberMap.cs b/tools/nnyeah/nnyeah/AssemblyComparator/TypeAndMemberMap.cs
index 027e8dc2c537..d4e16ea89b9b 100644
--- a/tools/nnyeah/nnyeah/AssemblyComparator/TypeAndMemberMap.cs
+++ b/tools/nnyeah/nnyeah/AssemblyComparator/TypeAndMemberMap.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Mono.Cecil;
using System.Xml.Serialization;
+using System.Diagnostics.CodeAnalysis;
#nullable enable
@@ -23,8 +24,48 @@ public class TypeAndMemberMap {
public List PropertiesNotPresent { get; init; } = new List ();
public Dictionary PropertyMap { get; init; } = new Dictionary ();
- public TypeAndMemberMap ()
+ public ModuleDefinition MicrosoftModule { get; init; }
+
+ public TypeAndMemberMap (ModuleDefinition module)
+ {
+ MicrosoftModule = module;
+ }
+
+ public bool TypeIsNotPresent (string typeName)
+ {
+ return TypesNotPresent.Contains (typeName);
+ }
+
+ public bool TryGetMappedType (string typeName, [NotNullWhen (returnValue: true)] out TypeDefinition? result)
+ {
+ return TypeMap.TryGetValue (typeName, out result);
+ }
+
+ public bool MemberIsNotPresent (string member)
+ {
+ return MethodsNotPresent.Contains (member) ||
+ FieldsNotPresent.Contains (member) ||
+ EventsNotPresent.Contains (member) ||
+ PropertiesNotPresent.Contains (member);
+ }
+
+ public bool TryGetMappedMember (string memberName, [NotNullWhen (returnValue: true)] out IMemberDefinition? member)
{
+ if (MethodMap.TryGetValue (memberName, out var method)) {
+ member = method;
+ return true;
+ } else if (FieldMap.TryGetValue (memberName, out var field)) {
+ member = field;
+ return true;
+ } else if (EventMap.TryGetValue (memberName, out var @event)) {
+ member = @event;
+ return true;
+ } else if (PropertyMap.TryGetValue (memberName, out var property)) {
+ member = property;
+ return true;
+ }
+ member = null;
+ return false;
}
}
}
diff --git a/tools/nnyeah/nnyeah/Errors.Designer.cs b/tools/nnyeah/nnyeah/Errors.Designer.cs
index 11da18cb2e51..22f76a940edd 100644
--- a/tools/nnyeah/nnyeah/Errors.Designer.cs
+++ b/tools/nnyeah/nnyeah/Errors.Designer.cs
@@ -160,5 +160,11 @@ internal static string E0012 {
return ResourceManager.GetString("E0012", resourceCulture);
}
}
+
+ internal static string E0013 {
+ get {
+ return ResourceManager.GetString("E0013", resourceCulture);
+ }
+ }
}
}
diff --git a/tools/nnyeah/nnyeah/Errors.resx b/tools/nnyeah/nnyeah/Errors.resx
index 4845fb0514c4..cad886fd663e 100644
--- a/tools/nnyeah/nnyeah/Errors.resx
+++ b/tools/nnyeah/nnyeah/Errors.resx
@@ -76,10 +76,13 @@
Type {0} not found.
- Error while attempting to compare assemblies: {1}
+ Error while attempting to compare assemblies: {0}
- UiquingStringDictionary entry with key {0} has illegal value {1}.
+ Error while attempting to map type {0} in old assembly. This type does not exist in the new assembly or has been renamed. Conversion can't continue. Your best option is to port the old assembly to .NET 6
+
+
+ Error while attempting to map member {0} in old assembly. This member does not exist in the new assembly or has been renamed. Conversion can't continue. Your best option is to port the old assembly to .NET 6
diff --git a/tools/nnyeah/nnyeah/MemberNotFoundException.cs b/tools/nnyeah/nnyeah/MemberNotFoundException.cs
new file mode 100644
index 000000000000..544afb1f2944
--- /dev/null
+++ b/tools/nnyeah/nnyeah/MemberNotFoundException.cs
@@ -0,0 +1,12 @@
+using System;
+namespace Microsoft.MaciOS.Nnyeah {
+ public class MemberNotFoundException : Exception {
+ public MemberNotFoundException (string memberName)
+ : base ($"Member {memberName} not found.")
+ {
+ MemberName = memberName;
+ }
+
+ public string MemberName { get; init; }
+ }
+}
diff --git a/tools/nnyeah/nnyeah/Program.cs b/tools/nnyeah/nnyeah/Program.cs
index 4e1947a56609..f10b1f666829 100644
--- a/tools/nnyeah/nnyeah/Program.cs
+++ b/tools/nnyeah/nnyeah/Program.cs
@@ -46,7 +46,7 @@ static void Main (string [] args)
out var typeAndModuleMap, out var failureReason)) {
Console.Error.WriteLine (Errors.E0011, failureReason);
}
- ReworkFile (infile!, outfile!, verbose, forceOverwrite, suppressWarnings);
+ ReworkFile (infile!, outfile!, verbose, forceOverwrite, suppressWarnings, typeAndModuleMap!);
}
static bool TryLoadTypeAndModuleMap (string earlier, string later, bool publicOnly,
@@ -61,7 +61,7 @@ static bool TryLoadTypeAndModuleMap (string earlier, string later, bool publicOn
var laterModule = ModuleDefinition.ReadModule (laterFile);
var comparingVisitor = new ComparingVisitor (earlierModule, laterModule, publicOnly);
- var map = new TypeAndMemberMap ();
+ var map = new TypeAndMemberMap (laterModule);
comparingVisitor.TypeEvents.NotFound += (s, e) => { map.TypesNotPresent.Add (e.Original); };
comparingVisitor.TypeEvents.Found += (s, e) => { map.TypeMap.Add (e.Original, e.Mapped); };
@@ -91,7 +91,7 @@ static bool TryLoadTypeAndModuleMap (string earlier, string later, bool publicOn
static void ReworkFile (string infile, string outfile, bool verbose, bool forceOverwrite,
- bool suppressWarnings)
+ bool suppressWarnings, TypeAndMemberMap typeMap)
{
var warnings = new List ();
var transforms = new List ();
@@ -108,7 +108,7 @@ static void ReworkFile (string infile, string outfile, bool verbose, bool forceO
using var stm = new FileStream (infile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
- var reworker = new Reworker (stm);
+ var reworker = new Reworker (stm, typeMap);
try {
reworker.Load ();
@@ -130,8 +130,14 @@ static void ReworkFile (string infile, string outfile, bool verbose, bool forceO
if (!suppressWarnings) {
warnings.ForEach (Console.WriteLine);
}
+ } catch (TypeNotFoundException e) {
+ Console.Error.Write (Errors.E0012, e.TypeName);
+ Environment.Exit (1);
+ } catch (MemberNotFoundException e) {
+ Console.Error.WriteLine (Errors.E0013, e.MemberName);
+ Environment.Exit (1);
} catch (Exception e) {
- Console.Error.Write (Errors.E0004, e.Message);
+ Console.Error.WriteLine (Errors.E0004, e.Message);
Environment.Exit (1);
}
} else {
diff --git a/tools/nnyeah/nnyeah/Reworker.cs b/tools/nnyeah/nnyeah/Reworker.cs
index af811a822d82..23dcb3a215b8 100644
--- a/tools/nnyeah/nnyeah/Reworker.cs
+++ b/tools/nnyeah/nnyeah/Reworker.cs
@@ -6,6 +6,7 @@
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
+using Microsoft.MaciOS.Nnyeah.AssemblyComparator;
namespace Microsoft.MaciOS.Nnyeah {
public class Reworker {
@@ -21,6 +22,8 @@ public class Reworker {
TypeReference nfloatTypeReference = EmptyTypeReference;
TypeReference newNfloatTypeReference = EmptyTypeReference;
ModuleReference newNfloatModuleReference = EmptyModuleReference;
+ TypeDefinition newNativeHandleTypeDefinition = EmptyTypeDefinition;
+ TypeAndMemberMap moduleMap;
Dictionary methodSubs = new Dictionary ();
Dictionary fieldSubs = new Dictionary ();
@@ -28,9 +31,10 @@ public class Reworker {
public event EventHandler? WarningIssued;
public event EventHandler? Transformed;
- public Reworker (Stream stm)
+ public Reworker (Stream stm, TypeAndMemberMap moduleMap)
{
this.stm = stm;
+ this.moduleMap = moduleMap;
}
public void Load ()
@@ -78,6 +82,7 @@ public void Rework (Stream stm)
newNfloatModuleReference = new ModuleReference ("System.Private.CoreLib");
newNfloatTypeReference = new TypeReference ("System.Runtime.InteropServices",
"NFloat", null, newNfloatModuleReference, true);
+ newNativeHandleTypeDefinition = moduleMap.MicrosoftModule.Types.First (t => t.FullName == "ObjCRuntime.NativeHandle");
// load the substitutions
methodSubs = LoadMethodSubs ();
@@ -207,6 +212,13 @@ bool TryReworkTypeReference (TypeReference type, List nativeTypes, [NotNul
// For any of nint, nuint, this will set the particular bool to true, false otherwise.
// This list will get passed to NativeIntegerAttribute, which is the special sauce
// that lets the runtime tell the difference between IntPtr and nint.
+
+ var typeAsString = type.ToString ();
+
+ if (moduleMap.TypeIsNotPresent (typeAsString)) {
+ throw new TypeNotFoundException (typeAsString);
+ }
+
if (type == module.TypeSystem.IntPtr || type == module.TypeSystem.UIntPtr) {
nativeTypes.Add (false);
result = type;
@@ -220,6 +232,9 @@ bool TryReworkTypeReference (TypeReference type, List nativeTypes, [NotNul
nativeTypes.Add (false);
result = newNfloatTypeReference;
return true;
+ } else if (moduleMap.TryGetMappedType (typeAsString, out var mappedType)) {
+ result = mappedType;
+ return true;
} else if (type.IsGenericInstance) {
return TryReworkGenericType ((GenericInstanceType) type, nativeTypes, out result);
} else if (type.IsArray) {
@@ -257,6 +272,23 @@ void ReworkCodeBlock (MethodBody body)
{
var changes = new List> ();
foreach (var instruction in body.Instructions) {
+ if (instruction.Operand?.ToString () is string operandText) {
+ if (moduleMap.TypeIsNotPresent (operandText)) {
+ throw new TypeNotFoundException (operandText);
+ }
+ if (moduleMap.MemberIsNotPresent (operandText)) {
+ throw new MemberNotFoundException (operandText);
+ }
+ if (moduleMap.TryGetMappedType (operandText, out var type)) {
+ var newInstruction = ChangeTypeInstruction (instruction, type);
+ changes.Add (new Tuple (instruction, new Transformation (operandText, newInstruction)));
+ continue;
+ } else if (moduleMap.TryGetMappedMember (operandText, out var member)) {
+ var newInstruction = ChangeMemberInstruction (instruction, member);
+ changes.Add (new Tuple (instruction, new Transformation (operandText, newInstruction)));
+ continue;
+ }
+ }
if (TryGetMethodTransform (instruction, out var transform)) {
changes.Add (new Tuple (instruction, transform));
continue;
@@ -278,6 +310,41 @@ void ReworkCodeBlock (MethodBody body)
}
}
+ static Instruction ChangeTypeInstruction (Instruction instruction, TypeDefinition typeDef)
+ {
+ if (instruction.Operand is TypeReference) {
+ return Instruction.Create (instruction.OpCode, typeDef);
+ }
+ // should never happen
+ throw new ArgumentException (nameof (instruction));
+ }
+
+ static Instruction ChangeMemberInstruction (Instruction instruction, IMemberDefinition member)
+ {
+ switch (member) {
+ case MethodDefinition method:
+ if (instruction.Operand is MethodReference) {
+ return Instruction.Create (instruction.OpCode, method);
+ }
+ // should never happen
+ throw new ArgumentException (nameof (instruction));
+ case FieldDefinition field:
+ if (instruction.Operand is FieldReference) {
+ return Instruction.Create (instruction.OpCode, field);
+ }
+ // should never happen
+ throw new ArgumentException (nameof (instruction));
+ case EventDefinition @event:
+ case PropertyDefinition @property:
+ // AFAICT no instruction will ever have a property or event
+ // as its operand.
+ throw new ArgumentException (nameof (member));
+ default:
+ throw new ArgumentException ($"Unknown member of type {member.GetType ().Name}", nameof (member));
+
+ }
+ }
+
bool TryGetMethodTransform (Instruction instr, [NotNullWhen (returnValue: true)] out Transformation? result)
{
if (instr.OpCode != OpCodes.Call && instr.OpCode != OpCodes.Calli
diff --git a/tools/nnyeah/nnyeah/TypeNotFoundException.cs b/tools/nnyeah/nnyeah/TypeNotFoundException.cs
new file mode 100644
index 000000000000..a62a7fba059d
--- /dev/null
+++ b/tools/nnyeah/nnyeah/TypeNotFoundException.cs
@@ -0,0 +1,12 @@
+using System;
+namespace Microsoft.MaciOS.Nnyeah {
+ public class TypeNotFoundException : Exception {
+ public TypeNotFoundException (string typeName)
+ : base ($"The type {typeName} was not found.")
+ {
+ TypeName = typeName;
+ }
+
+ public string TypeName { get; init; }
+ }
+}