Comments (2)
Hi @Liklainy, thanks for getting in touch.
@bitsandfoxes we could fairly easily implement our own EnsureSuccessStatusCode
for target frameworks below .net5.0
. I know Matt was against this on principal, as it would mean we wouldn't get any fixes if the code we copied changed.
However, we've already got a workaround for the broken framework code, but at the moment that workaround only protects the proper functioning of our own code (but doesn't guarantee other stuff won't get broken).
In this particular case, I'd be OK to bend the "don't copy framework code into our solution" rule, as long as our code is only used on .netcore3.1 and below. Under the hood, all EnsureSuccessStatusCode
does is throw an exception if the response status code isn't in the 200 range, so trivial to implement ourselves:
- https://github.com/microsoft/referencesource/blob/51cf7850defa8a17d815b4700b67116e3fa283c2/System/net/System/Net/Http/HttpResponseMessage.cs#L117-L120
- https://github.com/microsoft/referencesource/blob/51cf7850defa8a17d815b4700b67116e3fa283c2/System/net/System/Net/Http/HttpResponseMessage.cs#L142-L159
from sentry-dotnet.
Hi @jamescrosswell, thank you for quick reply!
I can suggest two ways to fix this issue:
- As a simple and crude fix we can store
Content
stream locally, make itnull
so it will not be disposed, and restore it infinally
- Throwing an exception just to immediately catch it doesn't make any sense. We only need to create an exception with
new
. ButHttpRequestException
has a different structure in different versions, for example,StatusCode
was added as a separate property which probably should be initialized for compatibility, which leads to more #if workarounds. Maybe the best way will be to create a separate custom exception class
from sentry-dotnet.
Related Issues (20)
- EF Core errors grouping and message issue
- AppSettings values not working using latest Sentry HOT 10
- Performance Query Logging for SqlClient in Asp.Net 4.8 HOT 6
- Flaky: Profiler_ThrowingOnSessionStartup_DoesntBreakSentryInit HOT 6
- Blocking detection
- Enable AVD caching during Android Device Tests
- Integrationtests for `Session`
- No service for type 'Sentry.IHub' has been registered
- MAUI: Option for adding button text to breadcrumbs HOT 1
- Connecting Queries with Code
- Metrics not showing in the Sentry Dashboard
- ArgumentNullException When No DSN Is Configured (4.X) HOT 19
- Sentry.Samples.AspNetCore.Mvc is missing tunneling config
- Migration guide: How to disable Sentry when no DSN supplied HOT 9
- AddAspNet() gone in 4.x HOT 1
- Allow for optional separation into services.AddSentry and app.UseSentry HOT 3
- Should config values from Environment variables override other settings? HOT 1
- AppDomainProcessExitIntegration doesn't get unregistered when Sentry is disposed of/closed HOT 1
- Align configuration binding precedence with Microsoft priorities HOT 2
- Sentry init fails with empty DSN string HOT 2
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 sentry-dotnet.