Skip to content

Commit

Permalink
[objcruntime] Enable nullable on ErrorHelper and RuntimeException (
Browse files Browse the repository at this point in the history
…#12377)

also avoid intermediate/chained calls to help the linker eliminate
some methods
  • Loading branch information
spouliot authored Aug 9, 2021
1 parent cffd57d commit 9307052
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/ObjCRuntime/ErrorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using ProductException=ObjCRuntime.RuntimeException;
#endif

#nullable enable

#if BUNDLER || MSBUILD_TASKS
namespace Xamarin.Bundler {
#else
Expand All @@ -19,20 +21,20 @@ namespace ObjCRuntime {
static partial class ErrorHelper {
public static ProductException CreateError (int code, string message, params object [] args)
{
return new ProductException (code, true, message, args);
return new ProductException (code, true, null, message, args);
}

public static ProductException CreateError (int code, Exception innerException, string message, params object [] args)
public static ProductException CreateError (int code, Exception? innerException, string message, params object [] args)
{
return new ProductException (code, true, innerException, message, args);
}

public static ProductException CreateWarning (int code, string message, params object [] args)
{
return new ProductException (code, false, message, args);
return new ProductException (code, false, null, message, args);
}

public static ProductException CreateWarning (int code, Exception innerException, string message, params object [] args)
public static ProductException CreateWarning (int code, Exception? innerException, string message, params object [] args)
{
return new ProductException (code, false, innerException, message, args);
}
Expand All @@ -47,9 +49,9 @@ internal static IList<Exception> CollectExceptions (IEnumerable<Exception> excep

internal static void CollectExceptions (Exception ex, List<Exception> exceptions)
{
AggregateException ae = ex as AggregateException;
var ae = ex as AggregateException;

if (ae != null && ae.InnerExceptions.Count > 0) {
if (ae is not null && ae.InnerExceptions.Count > 0) {
foreach (var ie in ae.InnerExceptions)
CollectExceptions (ie, exceptions);
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/ObjCRuntime/RuntimeException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;

#nullable enable

namespace ObjCRuntime {
public class RuntimeException : Exception {
public RuntimeException (string message, params object[] args)
Expand All @@ -11,7 +13,7 @@ public RuntimeException (string message, params object[] args)
}

public RuntimeException (int code, string message, params object[] args) :
this (code, false, message, args)
this (code, false, null, message, args)
{
}

Expand All @@ -20,7 +22,7 @@ public RuntimeException (int code, bool error, string message, params object[] a
{
}

public RuntimeException (int code, bool error, Exception innerException, string message, params object[] args) :
public RuntimeException (int code, bool error, Exception? innerException, string message, params object[] args) :
base (String.Format (message, args), innerException)
{
Code = code;
Expand Down
2 changes: 1 addition & 1 deletion tools/mmp/mmp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<AssemblyName>mmp</AssemblyName>
<RootNamespace>mmp</RootNamespace>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<LangVersion>8.0</LangVersion>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
Expand Down

5 comments on commit 9307052

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (only version changes)

Packages generated

View packages

Test results

4 tests failed, 225 tests passed.

Failed tests

  • link sdk/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 129 Passed: 111 Inconclusive: 6 Failed: 1 Ignored: 17)
  • link sdk/Mac Catalyst/Debug: Failed (Tests run: 135 Passed: 122 Inconclusive: 6 Failed: 1 Ignored: 12)
  • xcframework-test/Mac Catalyst/Debug: TimedOut (Execution timed out after 1200 seconds.
    No test log file was produced)
  • Documentation/All: Failed

Pipeline on Agent XAMBOT-1035.BigSur'
[objcruntime] Enable nullable on ErrorHelper and RuntimeException (#12377)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[objcruntime] Enable nullable on ErrorHelper and RuntimeException (#12377)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[objcruntime] Enable nullable on ErrorHelper and RuntimeException (#12377)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌

Tests failed on M1 - Mac Big Sur (11.5).

Failed tests are:

  • xammac_tests

Pipeline on Agent
[objcruntime] Enable nullable on ErrorHelper and RuntimeException (#12377)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Tests passed on macOS Mac High Sierra (10.13) ✅

Tests passed

All tests on macOS X Mac High Sierra (10.13) passed.

Pipeline on Agent
[objcruntime] Enable nullable on ErrorHelper and RuntimeException (#12377)

Please sign in to comment.