This repository was archived by the owner on Jan 10, 2025. It is now read-only.
Always use NUnitTestAssemblyRunner's Load overload with the assembly name #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a workaround to support NativeAOT runtime with Xamarin.
Introduction
The limitation comes from the unsupported or limited support for the following properties on
Assemblytype with NativeAOTCodeBase- unsupported feature - throws with: https://github.com/dotnet/runtime/blob/588dcd7a29f109daae2d8c999322acd8e853a8c6/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/General/ThunkedApis.cs#L70-L78Location- somewhat supported - empty string: https://github.com/dotnet/runtime/blob/588dcd7a29f109daae2d8c999322acd8e853a8c6/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/General/ThunkedApis.cs#L66Both properties do not seem to make sense with NativeAOT, as the assembly is not preserved in its original format.
These limitations prevent using NUnitTestAssemblyRunner's Load overload which accepts
Assemblyobject as parameter, which is discussed in the tracking issue: dotnet/macios#17774Changes
The included change, changes the way the
TestSuiteis created by NUnit framework for all runtimes.This affects the created name of test suites in the following way e.g.,:
monotouchtest.dll->monotouchtestEmbeddedResources.dll->EmbeddedResourcesThe change has been tested locally with monotouch-test running on iOS device using .NET7 mono runtime
Fixes: dotnet/macios#17774
/cc: @rolfbjarne