Coding Shorts: ASP.NET 8 - New Exception handling

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 69

  • @godfathermikal
    @godfathermikal Год назад +1

    Can't wait to upgrade. I have a need for this right now. 👏 Thank you, sir!

  • @poteb
    @poteb Год назад

    Much more cleaner than creating your own middleware and try/catch the MoveNext call.

  • @lyudmilpetrov79
    @lyudmilpetrov79 6 месяцев назад +1

    Thank you so much for your teaching great and simple presentation God bless you

  • @Phonophobic
    @Phonophobic Год назад

    Thanks so much for this. I liked/subscribed and did all the things. You’re doing great work, man.

  • @rockycaballero5676
    @rockycaballero5676 Год назад +1

    Great content Shawn, always joyful to see your content sir. Hope you will cover also new API Identity endpoint. Thanks and God bless :)

    • @swildermuth
      @swildermuth  Год назад +1

      Already did: ruclips.net/video/owoy6DG0UG0/видео.htmlsi=VYkeJIFfLOy4IE_E

    • @rockycaballero5676
      @rockycaballero5676 Год назад

      ah I see. thanks :-)

  • @larrye
    @larrye Год назад

    Looks like a good step forward. I've always wanted the try/catch syntax to be stream-lined.
    Maybe create a Base class (or decorator) that could handle process/handle most exceptions that would allow a lot of boilerplate exception handling to be moved to another area... idk.
    thank you for the video.

  • @Rhysling2
    @Rhysling2 Год назад

    Did not know about this. Thank you Shawn.

  • @DannyHille
    @DannyHille 11 месяцев назад

    Hi Shawn Nice video good example!
    Video idea: I constantly see people overusing the dotnet mediator pattern, even for small monolithic apps. I'm not saying never use it, but only use it if you really need the decoupling.
    The most common excuse for using it is for unit testing, or "it's best practice." I call BS. Besides, it's a PITA to debug badly written mediator components (for well-structured projects with good naming conventions, it can be less of a pain, though).
    I'd like to hear your opinion on that.

  • @stevestrong9363
    @stevestrong9363 Год назад

    Shawn , thanks for keeping us put to date is small practical and useful videos. I do not think any anyone has done a good treatment of object cloning, from the simple case to the shared reference case, so many ways to do it, reflection, code generation , Dehydrate - Hydrate, it could be a good series of videos

  • @k3davis
    @k3davis 8 месяцев назад

    This is an interesting pattern. One thing I missed is the scope of the exception handler - is it intended to handle every exception in your whole project, or just incoming http requests? For example would you have to use the httpcontext inside TryHandleAsync to limit its behavior to, say, just paths that start with /api (exposed endpoints)?

    • @swildermuth
      @swildermuth  8 месяцев назад

      It handles unhandled exceptions. It's the last line of defense, not used to avoid exception handling in your endpoints.

  • @kodindoyannick5328
    @kodindoyannick5328 Месяц назад

    Great content! Thanks!

  • @mouradaissani8957
    @mouradaissani8957 Год назад

    Thank you Shawn

  • @galberts
    @galberts Год назад

    Hy Shawn, always like your content, appreciated! As for suggestions: what would be a smart way to implement authorization in Blazor based on the ClientId the user is in combined with his/her role for that client. I guess Policy based authorization with AuthorizationHandler and PolicyHandler would be the one to use (check role) but how to combine specifying checking role and ClientId together? Ideally one would do [Authorize(Roles = "Administrator", ClientId = _clientId)], but the last parameter is not possible (is my fantasy).

    • @swildermuth
      @swildermuth  Год назад

      Not sure how it works in Blazor, I use claims, but where you create the claims is based on how you're doing Authentication.

  • @JuanOG
    @JuanOG Год назад +1

    I think using the hellangs problem details middleware is more useful for real world exception handling especially when we have to handle specific exceptions.

    • @swildermuth
      @swildermuth  Год назад

      Depends on what you want to do. But, since I haven't worked with it, I can't comment on how it works. It looks more like a way to log exceptions than to actually deal with them. But I get your point.

    • @S3Kglitches
      @S3Kglitches Год назад

      Yeah this. Returning ProblemDetails structure with status code based on exception subclass is the way to go.

    • @S3Kglitches
      @S3Kglitches Год назад

      ​ @swildermuth How have you handled exceptions on REST API so far in a standard way (RFC 9457) then if you haven't used that? It's basically a thing which is missing in ASP NET Core REST APIs

  • @jawwadalam
    @jawwadalam Год назад

    Thank you for explaining this.
    So I am assuming we can register multiple exception handlers and if that is the case will they follow any particular execution order like we see for middleware?

  • @AkashAggarwal-b7h
    @AkashAggarwal-b7h 11 месяцев назад

    .net aspire would be a good one from you shawn

  • @petropzqi
    @petropzqi Год назад

    Great video. Would love to see you deploy an aspire on a self-hosted environment, such as a raspberry pie and windows server 2016

    • @swildermuth
      @swildermuth  Год назад +1

      Still getting my head around Aspire and it's use cases. When you say 'self-hosted' - do you mean called from the command-line?

  • @henrik3098
    @henrik3098 Год назад

    Great video Shawn! =)

  • @vesnx
    @vesnx Год назад

    this .http file is cool, I guess PostMan and Fidler do not think so but me as a developer... love it

  • @dasokume9411
    @dasokume9411 Год назад +1

    awesome content

  • @rankarat
    @rankarat Год назад

    Thanks that's was really helpful.

  • @PeacefulMindss
    @PeacefulMindss Год назад

    I like it, thank you.

  • @siavash2176
    @siavash2176 Год назад

    Hopefully it will not throw another exception when you set response status code, I had this experience with old exception handler middleware, sometimes it throws exception when you set the response status code and it says that status is already set or response is already begun.

  • @jorgepedraza1275
    @jorgepedraza1275 Год назад

    Any Repository related to this video? Thx

  • @syllabailo6006
    @syllabailo6006 Год назад

    Thanks Mr Shawn for your help with youtub and plurilsigh, please do you have a private learning center where people can change idea and learn ?

    • @swildermuth
      @swildermuth  Год назад +2

      I am considering creating a discord for fans. Subscribe and you'll find out when it goes live.

    • @syllabailo6006
      @syllabailo6006 Год назад

      @@swildermuth ok sir thanks

  • @bernpaul9868
    @bernpaul9868 6 месяцев назад

    what advice you would giive to a seasonal dotnet developer like me ? or a beginner T_T my mind is sooo overwhelmed with a lot of informations need to understand

    • @swildermuth
      @swildermuth  6 месяцев назад

      You don't have to drink through the firehose. Focus on making code that accomplishes the task .

  • @youshasajjad5402
    @youshasajjad5402 10 месяцев назад

    hi is there anyway i can use parameterized Mappers in dotnet core?

    • @youshasajjad5402
      @youshasajjad5402 10 месяцев назад

      if so how do i register those mappers?

    • @swildermuth
      @swildermuth  10 месяцев назад

      Maybe, can you explain what you mean? I think Mapster and AutoMapper support something like that, but I am not sure exactly what you mean?

  • @SaeedBalkhair
    @SaeedBalkhair Год назад

    how can i run two project of dontnet (asp mvc and api) in same time in vscode?

    • @swildermuth
      @swildermuth  Год назад +1

      Best way is to just use two terminal windows and call "dotnet run" in each folder

    • @SaeedBalkhair
      @SaeedBalkhair Год назад

      @@swildermuth 👍

  • @UmmarFarooqMahroof
    @UmmarFarooqMahroof Год назад

    hey can you do a quick video of VSCode, .NET MAUI dev with the C# devkit, either you or the legendary Scott Hanselman....please

    • @swildermuth
      @swildermuth  Год назад +1

      I don't have the Maui experience I'd need to do it. But I'll throw it on my list to see if I can do it.

    • @UmmarFarooqMahroof
      @UmmarFarooqMahroof Год назад

      @@swildermuth much appreciated and thank you, actually I think I need to pester @jamesmontemagno

  • @unskeptable
    @unskeptable 10 месяцев назад

    Exception handler is throwing an exception. 😂 That is such a Microsoft thing to happen

  • @leftjabrighthook
    @leftjabrighthook Год назад +2

    Dude…. Put the camera down step away from the computer and go outside and get some physical activity in. Exceptions don’t mean shit if you are dead.

    • @swildermuth
      @swildermuth  Год назад +1

      Wait, am I fat? I never noticed. This sort of post ends up shaming and not supporting people. It's more complex than that.

    • @allenleggett4361
      @allenleggett4361 7 месяцев назад

      @@swildermuth As my grandmother said, "Beauty is only skin deep. UGLY goes straight through to the bone!" - We love you Shawn, you are beautiful to us. Thanks for all you do - and the crap you put up with while making the world a better place.

  • @kfathi1
    @kfathi1 Год назад

    nice