All Questions
108 questions
0
votes
2
answers
109
views
Logging an exception before throwing it
In my application, I have a Logger that writes messages about application behavior into a log file. If an exception is about to be thrown, I want it to be logged as well. To achieve this, I'm passing ...
0
votes
1
answer
58
views
No exceptions or logging when missing dependency with IHostedService?
A colleague of mine is working on a console app, and we had a bit of a stumble. Launching the app would simply flash up an empty console window, which would then immediately close.
No breakpoints ...
1
vote
1
answer
838
views
Show details of uncaught exception in Blazor UI
We have a customer that is using a custom browser, which doesn't allow them to open the console to see the logged error messages. Unfortunately we don't have access to their system so we need to ...
0
votes
0
answers
63
views
Throw an exception in Debug/Debugger attached, but Log Error in Production?
There are some paths that I want to throw an Exception when I'm working / debugging, but pass (and Log an error) when in Release.
This means:
while working/debugging I can investigate the call stack ...
0
votes
1
answer
117
views
C# Export Logs to 2 txt files
So I have a button made from my xaml file (view), called Export.
When the user clicks on it, the logs created during the run of the app get exported to Logs.txt.
If there are Warnings, Errors or ...
0
votes
1
answer
28
views
Line number with exception logging for deployed apps
I've got a WPF application (c#) that I currently have deployed via ClickOnce. I have a class called LogTracker that catches all exceptions and appends them to a text file along with some info like the ...
0
votes
1
answer
37
views
Is there a way to pass the entire exception object to an error handling page in a c# webform
Seems like I should be able to pass the entire exception object over to another page. In this case I am creating a custom error handling page. I have searched everywhere but I am not finding what I am ...
1
vote
1
answer
838
views
Message template in exception c#
I would like to create an exception where I can pass a structured message template. Is that possible? (also to log it immediately like that with Serilog)
Example on how I would like to use this:
throw ...
10
votes
3
answers
10k
views
Get the current exception in blazor Error Boundary
I have an exception that has been generated in a certain context of my application.
I would like to be able to collect it, send it to the logger and recover the previous state.
The problem is that ...
2
votes
1
answer
3k
views
EF Core exception : Npgsql.PostgreException: '42703' Column c1.Index does not exist
Using EFCore 6.0.8 in a .net 6 project.
I receive an Exception: Npgsql.PostgreException: '42703' Column c1.Index does not exist when I try to load a hierarchy of classes.
I know I do not have any ...
1
vote
1
answer
181
views
How to render Exception.Data dictionary the same way IncludeEventProperties does for event properties in NLog?
Is it possible to get NLog using JsonLayout to write out the Exception.Data dictionary as actual JSON instead of just a single attribute serialized with its toString?
The closest I have been able to ...
1
vote
0
answers
737
views
Logs not written within C# Async method that thrown an exception
I've been assigned a bug to investigate. It is occurring within a component in one of our integration test environments. The exception thrown and logged is fairly generic, and completely unhelpful, so ...
0
votes
0
answers
309
views
After adding a logger (serilog), I no longer receive the error messages associated with 500 errors in the response
Using .NET Core 3.1 in a non-production environment, I figured the exceptions were at one point being displayed in the body of failed 500 error responses as an added bonus of me using ...
6
votes
1
answer
6k
views
Serilog best practices with exceptions
I use Serilog for diagnostics in my .NET Core 5 console application. I can't decide the best logging semantics in conjunction with exception handling. For example, suppose I perform an operation that ...
1
vote
0
answers
209
views
NLog - modifying exception message
Is there a way to modify the message written by NLog when logging exceptions? E.g.: by registering a function that receives the message as a parameter and returns the message to be logged as output. ...