jsnlog icon indicating copy to clipboard operation
jsnlog copied to clipboard

Injection fails for Static Files in .NET 7

Open Jaben opened this issue 3 years ago • 0 comments

Thanks for this excellent tool. I turned off the injection because it was causing problems in the pipeline:

System.NullReferenceException: Object reference not set to an instance of an object.
   at JSNLog.Infrastructure.ResponseStreamWrapper.FlushAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Http.StreamResponseBodyFeature.SendFileAsync(String path, Int64 offset, Nullable`1 count, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Http.SendFileResponseExtensions.SendFileAsyncCore(HttpResponse response, String fileName, Int64 offset, Nullable`1 count, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Http.SendFileResponseExtensions.SendFileAsyncCore(HttpResponse response, IFileInfo file, Int64 offset, Nullable`1 count, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.StaticFiles.StaticFileContext.SendAsync()
   at Microsoft.AspNetCore.StaticFiles.StaticFileContext.ServeStaticFile(HttpContext context, RequestDelegate next)
   at Cas.SpecCom.Shared.Web.Core.Infrastructure.Middleware.Redirect404EndpointRequestsToFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Kestrel was handling the failure ultimately -- but all the errors were:

System.InvalidOperationException: Response Content-Length mismatch: too few bytes written (0 of 25793).

Jaben avatar Nov 17 '22 14:11 Jaben