-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Description
If your TryParse
method has a nullable out parameter and is a struct it fails to find the TryParse method and will throw:
System.InvalidOperationException : No public static bool MyBindAsyncRecord.TryParse(string, out MyBindAsyncRecord) method found for myBindAsyncRecord.
private record struct MyBindAsyncRecord(Uri Uri)
{
public static bool TryParse(string? value, out MyBindAsyncRecord? result) =>
throw new NotImplementedException();
}
This is because the method parameter type is Nullable`1[[MyBindAsyncRecord]]&
and we pass MyBindAsyncRecord&
methodInfo = type.GetMethod("TryParse", BindingFlags.Public | BindingFlags.Static, new[] { typeof(string), typeof(IFormatProvider), type.MakeByRefType() }); |
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels