Blazor Server - global logging of unhandled exceptions - asp.net-mvc

I have a Blazor Server app in which I log requests/other stuff using ILogger (Serilog under the hood).
The problem is that when an unhandled exception occurs, the circuit breaks and that error is logged only to the browser console. I want to be able to log the exception in a global manner so that I can later check the logs (Seq) and address the issue.
I already looked here https://github.com/dotnet/aspnetcore/issues/13452 but cannot wrap my head around a solution.
I don't think the question requires a code example.

Related

DirectX12: dxgi dll catastrophic failure when creating IDXGIFactory

I'm attempting to initialize an IDXGIFactory4 using the CreateFactory2 function however this throws out an error:
onecore\windows\directx\database\helperlibrary\lib\perappusersettingsqueryimpl.cpp(121)\dxgi.dll!00007FFBA0D6D7F8: (caller: 00007FFBA0D4D167) ReturnHr(1) tid(64d8) 8000FFFF Catastrophic failure
onecore\windows\directx\database\helperlibrary\lib\perappusersettingsqueryimpl.cpp(98)\dxgi.dll!00007FFBA0D6D4D0: (caller: 00007FFBA0D3E221) ReturnHr(2) tid(64d8) 8000FFFF Catastrophic failure
onecore\windows\directx\database\helperlibrary\lib\directxdatabasehelper.cpp(999)\dxgi.dll!00007FFBA0D6D4FC: (caller: 00007FFBA0D3E221) ReturnHr(3) tid(64d8) 8000FFFF Catastrophic failure
I have not found any similar error messages online.
I have attempted running the function on its own and initializing as a different IDXGIFactory (e.g. IDXGIFactory2) instead but both still lead to the same issue.
ComPtr<IDXGIFactory> dxgiFactory;
UINT factoryFlags = DXGI_CREATE_FACTORY_DEBUG;
ThrowIfFailed(CreateDXGIFactory2(factoryFlags, IID_PPV_ARGS(&dxgiFactory)));
This is not the error as you describe it.
There is no real failure, there is no catastrophy, there is no even exception and there is no error code returned to you from the API call. What you are seeing is a glitch in internal API implementation that emits debug output with these strange lines. Apparently it is a small problem in Microsoft's API implementation and the weird format of the message suggests it comes from use of wil in one the modules: they probably intended to remove this output from Release build of the software but somehow it worked out in a different way and unintended debug output passed through...
The message is likely to correspond to recoverable internal error condition which is then handled and your API call ends up being successful. Nothing to worry about, it's just up to Microsoft to make things cleaner.
These errors happen even with any Blank app straight from the templates (or sample apps from Microsoft Github repos) in Visual Studio 2019 (v16.9.1). It's only annoying, apps never crash nor hang. However, this never happend before.
I hope Microsoft better fix this soon (it's bad for nerves and mental health). You can do nothing about it.

SignalR perfectly run on local database but throws exception on server database

My code (SignalR) perfectly runs on a local database when I am trying to use with server database, I get an exception.
Code is here:
https://github.com/mewanindula/SignalR-SQL_Dependency
Exception :
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
Additional information: Cannot find the object "QueryNotificationErrorsQueue" because it does not exist or you do not have permissions
How to resolve this exception?
Please help me out.
Thanks in advance
Do you have access to the database through Microsoft SQL Server Management Studio? If so go to the Management node and Sql Server Logs and there you can see if there are any errors logged when you try to access the database:
The errors that are logged can give you a much better error description to solve your problem.

"<Program> has stopped working" explanation

Can someone explain me when Windows shows this message?
What do i have to do to stop my Program from throwing this exception?
I have a Delphi Windows Forms Program which throws this message short after doing some SQL operations.
So i do the SQL, everything seems fine at first, but at a random time after that windows is killing it by showing this message...
the intresting thing is, it only occours while debugging.
When i'm not debugging it's running perfectly stable.
EDIT: Using RAD-Studio2009
I dont want to turn off the message completely(Only hint i found by using Google)
i want to stop my program giving windows a Reason to do that.
Windows shows this message when an unhandled exception leaks out of your application. This is a fatal condition. Something very wrong has happened with your application because exceptions should all be caught.
You need to work out what is throwing the exception and why it is not being caught. The very first step is to expand the details of the error dialog and find out which module the fault is occurring in, what the fault is and so on. That should yield some high level clues at the very least.
Most likely the Delphi debugger will not be able to help you for such a fault. You need to configure your system to arrange for a crash dump to be produced by the Windows Error Reporting service. Then you can load up the error report in a tool like WinDbg and try to figure it out.

Pylons interactive debugger UnboundExecutionError

Where I work, we use Pylons for our web development framework. Every so often when debugging an error using Pylons' interactive debugger, I encouter a traceback that includes the following type of error regarding a variable, etc. not being bound to a session:
UnboundExecutionError: Instance is not bound to a Session; attribute refresh operation cannot proceed
When this error is present, I am never able to output what a variable, etc affected by this error type is equal to at the interactive debugger prompt. However, I am able to log this information to the paster shell I have running in my terminal. Has anyone ever encountered something similar, or can tell why this error occurs?
It's an SQLAlchemy error. To avoid it, eagerly load all of the object attributes before an exception happens, and then you should be able to inspect that object.
AFAIU this error happens because BaseController destroys the session when an exception happens (there's a try:/finally: statement that calls meta.Session.remove()), so when you get to a debugger the session is already gone and objects associated with that session cannot access it any more.

Logging all yellow screen of deaths, even when its a compilation problem

Earlier today we experienced a YSOD on one of our MVC sites running on IIS on Windows Server 2003.
Usually, these are reported via e-mail using ELMAH (using this setup), but since this was a compilation issue (of some sort), it did not get reported via e-mail.
The specific error was:
"The directory 'App_GlobalResources'
is not allowed because the application
is precompiled."
This is a major problem, since a potential customer could notice the problem before we do. How can we make sure these YSODs are logged, when the exception handler on the site is not called?
It is possible to monitor the event log with VBScript. You could then email this when it occurs:
Here's an example:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/feb07/hey0226.mspx
and email from vbscript:
http://www.paulsadowski.com/WSH/cdo.htm
You could do this with powershell and/or another .net app on the box also.
If you can, check the event viewer on that machine. This is the logger of last resort on a Windows machine.

Resources