Exception: Could not load type (edit)
How to Catch All Exceptions in C# & Find All Application Errors – Stackify
Best Practices for Error Handling in ASP.NET MVC – Stackify
Exception handling in ASP.NET MVC (6 methods explained) - CodeProject
Could not load file or assembly - Sitefinity CMS Deploy and upgrade (progress.com)
C# Exception Handling Best Practices – Stackify
Setup this event handler at the start of your application. In Program.cs, Startup.cs or your Global.asax file.
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) => { Debug.WriteLine(eventArgs.Exception.ToString()); };
FirstChanceException => LoaderException:
Issues with Xsd.exe (pawelszczygielski.pl)
Code
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
Debug.WriteLine(eventArgs.Exception.ToString());
};
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex != null)
{
Debug.WriteLine(ex.ToString());
}
}
}
For Example:
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
AppDomain.CurrentDomain.FirstChanceException += (se, ex) =>
{
Debug.WriteLine(ex.Exception.ToString());
};
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex != null)
{
Debug.WriteLine(ex.ToString());
}
}
}