Comments (16)
I've now created the issue: dotnet/aspnetcore#14609
Nice! That's a really well written issue! ✨
Did you already decide if you will also handle the exception in ProblemDetails?
It really depends on how fast it's fixed upstream. Since it's just a source package, I can easily pull the latest from MyGet and ship a new version without making source changes to the middleware itself. I'll see if maybe I can fix it myself and send a PR upstream.
from middleware.
Doesn't look like it's gotten to reading pdb yet, but throws while reading the dll to get the debug directory info.
I looked quickly at the code wondering if there was something letting go of the PE memory, but it looks ok.
The next thing I'd want to try would be to inspect the dll to see if it is in fact corrupted. Are you able to debug and determine what assemblyPath
parameter is here?
Cc @tmat
from middleware.
Hmm. That's weird. It's even mentioned in the source:
from middleware.
I think I might have to file an issue upstream for this...
from middleware.
It should support both portable and "full" PDBs, but the check for portable PDBs is below the GetPdbPath
call:
from middleware.
Are you able to debug and determine what
assemblyPath
parameter is here?
Debugging should be no problem. But since I'm not sure how to reproduce this reliably, I might have to try for some time.
An idea about assembly "corruption": I'm using the Oracle.ManagedDataAccess library. This assembly is obfuscated. Maybe that causes problems?
from middleware.
I'm using the Oracle.ManagedDataAccess library. This assembly is obfuscated. Maybe that causes problems?
Aha! I knew I'd seen that somewhere when Googling for more info on this; coverlet-coverage/coverlet#189
The latest version of Oracle.ManagedDataAccess.dll (which is of course copied to the output directory for a full framework build) fails to decompile in the latest ILSpy (it raises an exception when it tries reading the debug header with an invalid length)
Smells like Oracle is doing something fishy (won't be the first time 😅)...
from middleware.
I can now confirm that this indeed happens if Oracle.ManagedDataAccess throws an exception. The assemblyPath
parameter of the method Microsoft.Extensions.StackTrace.Sources.PortablePdbReader.GetPdbPath()
is the "Oracle.ManagedDataAccess.dll" in my bin directory.
So I assume this means this is actually a bug in System.Reflection.PortableExecutable.PEReader.ReadDebugDirectory()
and I have to file an issue in dotnet/corefx?
Or is the exception fine (since Oracle "broke" the assembly) and should be handled in Microsoft.Extensions.StackTrace.Sources.PortablePdbReader.GetPdbPath()
? Then it would be an issue for aspnet/AspNetCore.
But I think this exception could also be handled better in ProblemDetailsMiddleware
. Why does it fall back to returning a StatusCodeProblemDetails
if an ExceptionProblemDetails
is already available (see here)? If it would return the already available result
in the catch block, the developer would at least still get the exception message and stack trace. It feels like this was the plan with commit 58619e1, at least according to the message?
from middleware.
So I assume this means this is actually a bug in
System.Reflection.PortableExecutable.PEReader.ReadDebugDirectory()
and I have to file an issue in dotnet/corefx?
Or is the exception fine (since Oracle "broke" the assembly) and should be handled inMicrosoft.Extensions.StackTrace.Sources.PortablePdbReader.GetPdbPath()
? Then it would be an issue for aspnet/AspNetCore.
Yeah, I'm thinking it's the latter. I.e. the PEReader.ReadDebugDirectory()
can't read the binary and correctly throws a BadImageFormatException
. Would you like to file an issue or should I?
Why does it fall back to returning a
StatusCodeProblemDetails
if anExceptionProblemDetails
is already available (see here)? If it would return the already availableresult
in the catch block, the developer would at least still get the exception message and stack trace.
Hmm 🤔 I can't remember what my thinking was at the time. I think it was to avoid directly serializing an instance of ExceptionProblemDetails
, which includes the Exception
directly. Some exceptions might serialize easily, some might not.
I think it would be better to wrap it in a DeveloperProblemDetails
and just pass Array.Empty<ExceptionDetails>
to not include additional details. That would at least fill in the detail
, title
, instance
and type
fields:
Middleware/src/ProblemDetails/DeveloperProblemDetails.cs
Lines 16 to 23 in c454363
from middleware.
Would you like to file an issue or should I?
Would be nice if you could do it. Otherwise I'll do it on Monday.
That would at least fill in the
detail
,title
,instance
andtype
fields:
So it wouldn't give the stack trace? I'd say that's the most important information about an exception 😉
from middleware.
@khellang I forgot about this yesterday. I wanted to start with a small sample now, but I already have problems getting the ExceptionDetailsProvider
class available in my project. Is that MyGet dev feed really the "official" way to get this class?
from middleware.
Is that MyGet dev feed really the "official" way to get this class?
Yeah, the source packages aren't shipped to NuGet, so there's really no better way to get it 😏
from middleware.
I've now created the issue: dotnet/aspnetcore#14609
Did you already decide if you will also handle the exception in ProblemDetails?
from middleware.
Seems like your PR was merged, nice.
But do you have any idea when new packages are created? If I see this correctly, the newest package is from November 2018, which was before the code was moved from the aspnet/Extensions repo to the aspnet/AspNetCore repo.
from middleware.
I've pushed 4.0.0-beta.1 to NuGet. Let me know if that fixes your issue 👍
from middleware.
Works fine, thanks!
from middleware.
Related Issues (20)
- Disable ProblemDetailsResultFilter with condition like UseWhen (middleware) to support backwards compatibility HOT 1
- Does not work in .net 6 HOT 8
- How to show (AddProblemDetails) multiple validation error against single property using Fluent Validation & MediatR Pipeline Behaviour HOT 3
- `MapStatusCode` not respected for MVC validation errors HOT 1
- How can I use UseMemberCasing to serialize my data
- Ambiguous invocation in .Net 7 HOT 3
- Customize Exception Logging
- How to disable developer exception page middleware? HOT 3
- Issue with Serilog's RequestLogging and Rethrow HOT 8
- Changes in ASP.NET Core v7 HOT 3
- Master Branch not building in VS 2022 HOT 8
- ProblemDetailsMiddleware and DiagnosticListener.Write for handled exceptions
- [Feature request] ProblemDetails middleware allow send Detail property out of the box in Production HOT 2
- How to customise the ProblemDetails object when capturing FluentValidation exceptions? HOT 5
- Why are headers cleared at all by the middleware?
- ProblemDetails "Instance" property is not being set HOT 13
- How can I avoid returning internal class information in error?
- AddNewtonsoftJson and ProblemDetails using NET 6 HOT 1
- Add .NET 8 support for Authentication.JwtBearer.Google HOT 1
- [Feature request] Use custom mappers inside ProblemDetailsResultFilter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from middleware.