Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/workflow/building/coreclr/nativeaot.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ Sometimes it's handy to be able to rebuild the managed test manually or run the

For more advanced scenarios, look for at [Building Test Subsets](../../testing/coreclr/windows-test-instructions.md#building-test-subsets) and [Generating Core_Root](../../testing/coreclr/windows-test-instructions.md#generating-core_root)

### Running library tests
Build library tests by passing the `libs.tests` subset together with the `/p:TestNativeAot=true` to build the libraries, i.e. `clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs+libs.tests /p:TestNativeAot=true` together with the full arguments as specified [above](#building). Then, to run a specific library, go to the tests directory of the library and run the usual command to run tests for the library (see [Running tests for a single library](../../testing/libraries/testing.md#running-tests-for-a-single-library)) but add the `/p:TestNativeAot=true`, i.e. `dotnet.cmd build /t:Test /p:TestNativeAot=true`.

## Design Documentation

- [ILC Compiler Architecture](../../../design/coreclr/botr/ilc-architecture.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,22 @@ public sealed override MemberInfo GetMemberWithSameMetadataDefinitionAs(MemberIn
if (member is null)
throw new ArgumentNullException(nameof(member));

MemberInfo result = member.MemberType switch
// Need to walk up the inheritance chain if member is not found
// Leverage the existing cache mechanism of per type to store members
RuntimeTypeInfo? runtimeType = this;
while (runtimeType != null)
{
MemberInfo result = runtimeType.GetDeclaredMemberWithSameMetadataDefinitionAs(member);
if (result != null)
return result;
runtimeType = runtimeType.BaseType as RuntimeTypeInfo;
}
throw new ArgumentException(SR.Format(SR.Arg_MemberInfoNotFound, member.Name), nameof(member));
}

private MemberInfo GetDeclaredMemberWithSameMetadataDefinitionAs(MemberInfo member)
{
return member.MemberType switch
{
MemberTypes.Method => QueryMemberWithSameMetadataDefinitionAs<MethodInfo>(member),
MemberTypes.Constructor => QueryMemberWithSameMetadataDefinitionAs<ConstructorInfo>(member),
Expand All @@ -133,11 +148,6 @@ public sealed override MemberInfo GetMemberWithSameMetadataDefinitionAs(MemberIn
MemberTypes.NestedType => QueryMemberWithSameMetadataDefinitionAs<Type>(member),
_ => null,
};

if (result is null)
throw new ArgumentException(SR.Format(SR.Arg_MemberInfoNotFound, member.Name), nameof(member));

return result;
}

private M QueryMemberWithSameMetadataDefinitionAs<M>(MemberInfo member) where M : MemberInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void Invoke_OneDimensionalArray()

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67457", TestRuntimes.Mono)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/69336", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException()
{
ConstructorInfo[] constructors = GetConstructors(typeof(object[]));
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Reflection/tests/TypeInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ private static (Type, Type) CreateGeneratedTypes()
}

[Theory, MemberData(nameof(GetMemberWithSameMetadataDefinitionAsData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/67533", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/69244", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void GetMemberWithSameMetadataDefinitionAs(Type openGenericType, Type closedGenericType, bool checkDeclaringType)
{
BindingFlags all = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
Expand Down
1 change: 1 addition & 0 deletions src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
<!-- Run only a small randomly chosen set of passing test suites -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)*\tests\**\*.Tests.csproj" />
<ProjectExclusions Remove="$(MSBuildThisFileDirectory)System.Collections\tests\System.Collections.Tests.csproj" />
<ProjectExclusions Remove="$(MSBuildThisFileDirectory)System.Reflection\tests\System.Reflection.Tests.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down