-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-VM-reflection-monoReflection issues specific to MonoVMReflection issues specific to MonoVM
Description
Description
Running the aspnetcore Microsoft.AspNetCore.Server.Kestrel.Core.Tests unit tests on Mono fails with multiple errors along the lines of:
Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.StartLineTests.AuthorityForms(rawTarget: "localhost", path: "", query: "") [FAIL]
Assert.Same() Failure
Expected:
Actual:
Stack Trace:
/home/uweigand/aspnetcore/src/Servers/Kestrel/Core/test/StartLineTests.cs(478,0): at Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.StartLineTests.AuthorityForms(String rawTarget, String path, String query)
/home/uweigand/runtime/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs(370,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
This is because the test makes the assumption that if a custom argument has an empty string as default argument, that string will be reference-equal to string.Empty. This is true on CoreCLR but not on Mono.
Configuration
.NET 6 Preview7 re-built for the linux-s390x target (using the Mono runtime by default).
Regression?
No.
Other information
The Mono code path in load_cattr_value (src/mono/mono/metadata/custom-attrs.c) will always allocate a new string object, even if the string is empty. Adding a special case to use string.Empty for zero-length strings fixes the test case. I'll post a PR shortly.
Metadata
Metadata
Assignees
Labels
area-VM-reflection-monoReflection issues specific to MonoVMReflection issues specific to MonoVM