Skip to main content

All Questions

Tagged with
0 votes
0 answers
75 views

How to handle all exceptions in a global error handler, and suppress them? [duplicate]

I need to implement a global error handler without try, catch if an exception occurs somewhere then handle everything in one place. I have this code, it works until the error is in another thread: ...
Dmitro's user avatar
  • 25
0 votes
1 answer
52 views

Global handle exception .NET 8

I'm working on a fairly standard ASP.NET Core 8 Web API project. I added a module to globally capture exceptions, and it works fine. But now I'm trying to standardize the responses in the controllers ...
Robe79's user avatar
  • 59
0 votes
0 answers
43 views

"Could not load type 'System.Object' from assembly 'System.Private.CoreLib' because the parent does not exist" Exception in VSIX Project

Context I'm creating a Visual Studio 2022 Extension with a VSIX Project that consists of a window that displays the current Form (WinForms) classes of your project in a ComboBox and when you select ...
Luis Miguel Sánchez's user avatar
0 votes
1 answer
40 views

How to test(make sure it comes under Sonar coverage) Catch blocks?

I am new to NUnit(3.4+) and somehow not able to solve the below simple issue :) I want to make sure the catch blocks are covered in Sonar coverage and for that want to write a Nunit test case. I have ...
MB22's user avatar
  • 31
-3 votes
1 answer
77 views

Is throw reachable after return statement in using context? [duplicate]

Is this throw statement even reachable? It's not showing as unreachable by compiler. public static async Task<List<string>> GetSomething(int id) { using (DbContext context = new ...
Chris Hayes's user avatar
  • 4,035
0 votes
2 answers
33 views

IStartupFilter for exception handling in .NET integration tests not capturing the exceptions

I have an integration test using a WebapplicationFactory in .Net 9 to spin up the main Program.cs and hit endpoints. My problem is often an endpoint will return a generic 500 error when an unhandled ...
The Lemon's user avatar
  • 1,419
0 votes
2 answers
51 views

Should custom Exception class contains business rules? [closed]

I have a question regarding whether exception classes should contain business rules, for example, supposing I have several exception methods, and in these exception methods I end up populating entity ...
Vagner Wentz's user avatar
0 votes
2 answers
69 views

AggregateUpdateConcurrencyException when using DDD aggregate and pre-generated IDs

I have a Patient aggregate root entity with a list of Visit child entities under it. Per DDD principles, any operation on a Visit object is done through the aggregate root. Also, any persistence must ...
Martin's user avatar
  • 2,256
2 votes
1 answer
145 views

Switching to .Net 9 from 8 causes C++ std::exception to not be caught in expected catch block

We have several projects in a Visual Studio 2022 (17.13.2, may not be relevant) Solution, 1 C# console Application targeting .Net 8, 1 CLR Project also targeting .Net 8 and lastly a C++ static lib. ...
Cryosys's user avatar
  • 45
0 votes
0 answers
73 views

Dotnet core application retuning 500 Internal server response after hosting on IIS

I have created REST API Service in dotnet core. The application endpoints works fine when i run from the code but after publishing it into the IIS server when I try to access it then it gives me below ...
Harish Kumar's user avatar
1 vote
1 answer
73 views

Exception handling and re-throw in an mediated IAsyncEnumerable pipeline

I have Producer, Operator, and Consumer. Producer generates IAsyncEnumerable<TItem>. As example: interface IProducer<TItem> : IAsyncDisposable { IAsyncEnumerable<TItem> ...
Taras's user avatar
  • 59
1 vote
1 answer
67 views

Why is my global error handling not triggered when I throw a mock exception in my c# unit test?

I'm learning on how to write unit tests. From what I gathered, if I want to unit test a controller in a C# API, I need to mock/fake the inputs, the outputs and all dependencies of it. Next, I want to ...
Sonny's user avatar
  • 325
0 votes
0 answers
38 views

MinIO CopyObjectAsync AuthorizationException

I'm trying to copy an image from one folder to another using the MinIO library. I'm trying to use the CopyObjectAsync method and I'm getting a Minio.Exceptions.AuthorizationException: "The ...
Vladimir's user avatar
1 vote
1 answer
69 views

Design pattern with multiple cancellable tasks and unhandled exception handling [duplicate]

I want a C# console app that Runs multiple tasks Cancellable by Control C Unhandled exceptions in one task, cleanly cancel the other tasks. The below code deals with the cancellation correctly, but ...
Chris Davies's user avatar
0 votes
0 answers
47 views

Why masstransit acknowledge message if consumer throws exception?

I use masstransit with kafka. I thought masstransit would handle my exception in consumer and not acknowledge message. Сonsumer saves messages in the inbox, if the database is unavailable, an ...
Nikita Berezhko's user avatar

15 30 50 per page
1
2 3 4 5
636