Closed runfoapp[bot] closed 2 years ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @dotnet/area-system-reflection See info in area-owners.md if you want to be subscribed.
Author: | runfoapp[bot] |
---|---|
Assignees: | - |
Labels: | `area-System.Reflection`, `untriaged` |
Milestone: | - |
This is causing consistent issues across the repo. I am currently investigating on macOS.
Still building. Here are the known parts.
1) The test:
[Fact]
[SkipOnMono("Nullability attributes trimmed on Mono")]
public void NullablePublicOnlyOtherTypesTest()
{
Type type = typeof(Type);
FieldInfo privateNullableField = type.GetField("s_defaultBinder", flags)!;
NullabilityInfo info = nullabilityContext.Create(privateNullableField); // <------ Failing here
2) The value should exist on Type
.
public static Binder DefaultBinder
{
get
{
if (s_defaultBinder == null)
{
DefaultBinder binder = new DefaultBinder();
Interlocked.CompareExchange<Binder?>(ref s_defaultBinder, binder, null);
}
return s_defaultBinder!;
}
}
private static volatile Binder? s_defaultBinder;
My only guess here is the trimmer might have done something? I was assured the trimmer should not run in this case, but I don't see how else this test would fail as follows:
System.Reflection.Tests.NullabilityInfoContextTests.NullablePublicOnlyOtherTypesTest [FAIL]
System.ArgumentNullException : Value cannot be null. (Parameter 'fieldInfo')
Stack Trace:
at <PrivateImplementationDetails>.Throw(String paramName)
at <PrivateImplementationDetails>.ThrowIfNull(Object argument, String paramName)
at System.Reflection.NullabilityInfoContext.Create(FieldInfo fieldInfo)
/_/src/libraries/System.Runtime/tests/System/Reflection/NullabilityInfoContextTests.cs(763,0): at System.Reflection.Tests.NullabilityInfoContextTests.NullablePublicOnlyOtherTypesTest()
I think this is actually from https://github.com/dotnet/runtime/pull/65986, which removed the _code
field from Regex
cc @stephentoub
@elinor-fung Hmmm. I must have missed something but based on the stack you must be correct. I am still unable to reproduce this locally though.
Edit: I'm officially wearing the dunce hat today... I'm able to reproduce this locally and see the issue now.
I think this is actually from https://github.com/dotnet/runtime/pull/65986, which removed the _code field from Regex
Ugh. I'll fix it. We shouldn't be relying on private fields like this across test suites :(
This should be fixed by #66113
Displaying 100 of 191 results