CoreWCF
CoreWCF copied to clipboard
OpenApiSchemaBuilder.GetMethodUriWebInvoke can throw NullReferenceException
If swagger is turned on, then CoreWCF can make it fail to show its UI with exception Object reference not set to an instance of an object. Stack is
at CoreWCF.OpenApi.OpenApiSchemaBuilder.GetMethodUriWebInvoke(MethodInfo methodInfo)
at CoreWCF.OpenApi.OpenApiSchemaBuilder.PopulateOpenApiPath(OpenApiDocument document, MethodInfo methodInfo, IEnumerable`1 tagsToHide, String additionalBasePath, WebMessageFormat behaviorFormat, Func`2 getOperationInfo)
at CoreWCF.OpenApi.OpenApiSchemaBuilder.PopulateOpenApiPathsOperations(OpenApiDocument document, IEnumerable`1 contracts, IEnumerable`1 tagsToHide)
at CoreWCF.OpenApi.OpenApiSchemaBuilder.BuildOpenApiSpecificationDocument(OpenApiOptions info, IEnumerable`1 contracts)
at CoreWCF.OpenApi.OpenApiDocumentProvider.GetSwagger(String documentName, String host, String basePath)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
As this is a project where conversion from net framework to net core is a WIP, its likely I've not got everything right, but some clues in the error message would be helpful.
I think I see the issue. Do you have an endpoint with a WebInvoke attribute that doesn't have a Method set? If that is the case I'll put in a PR to fix this.
yes , lots e.g.
[WebInvoke]
public List<GradeResult> UpdateGrades(List<GradeAction> actions)
{
Then I think this PR will fix it: https://github.com/CoreWCF/CoreWCF/pull/729.