Giter Club home page Giter Club logo

Comments (2)

jamescrosswell avatar jamescrosswell commented on June 12, 2024

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:

from sentry-dotnet.

Liklainy avatar Liklainy commented on June 12, 2024

Hi @jamescrosswell, thank you for quick reply!

I can suggest two ways to fix this issue:

  1. As a simple and crude fix we can store Content stream locally, make it null so it will not be disposed, and restore it in finally
  2. Throwing an exception just to immediately catch it doesn't make any sense. We only need to create an exception with new. But HttpRequestException 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.