Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 2836386

Browse files
authored
Always use NUnitTestAssemblyRunner's Load overload with the assembly name (#116)
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 `Assembly` type with NativeAOT - `CodeBase` - 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-L78 - `Location` - somewhat supported - empty string: https://github.com/dotnet/runtime/blob/588dcd7a29f109daae2d8c999322acd8e853a8c6/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/General/ThunkedApis.cs#L66 Both 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 `Assembly` object as parameter, which is discussed in the tracking issue: dotnet/macios#17774 ### Changes The included change, changes the way the `TestSuite` is created by NUnit framework for all runtimes. This affects the created name of test suites in the following way e.g.,: - `monotouchtest.dll` -> `monotouchtest` - `EmbeddedResources.dll` -> `EmbeddedResources` - ...etc The change has been tested locally with monotouch-test running on iOS device using .NET7 mono runtime --- Fixes: dotnet/macios#17774
1 parent 564433f commit 2836386

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

NUnitLite/TouchRunner/TouchRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ protected virtual void ExecuteOnMainThread (Action action)
166166
public void LoadSync ()
167167
{
168168
foreach (Assembly assembly in assemblies)
169-
Load (assembly);
169+
Load (assembly.GetName().Name);
170170
assemblies.Clear ();
171171
}
172172

0 commit comments

Comments
 (0)