How to Force an Exception into Crashes rather than Errors in AppCenter using Crashes.TrackError or any other method - appcenter

In my mobile UWP/iOS app I log but ignore a number of exceptions. I am expecting these exceptions but still want to monitor them without losing the full details of the exception (call stack for example). This means I must use the Crashes.TrackError method rather than the Analytics.TrackEvent method.
However, this causes the ignored exceptions to get mixed in with the unexpected exceptions when I view them in AppCenter under Diagnostics, Issues, Errors. I'd like to split out unexpected exceptions to the Diagnostics, Issues, Crashes category.
Is there anyway to force an exception reported to AppCenter into the Crashes category?
As an alternative, is there any way to set the status of an error reported to AppCenter to Ignored?

Related

Exception handling in App Insights TelemetryInitializer

I'm adding several custom properties to my AppInsights events using Initialize method of ITelemetryInitializer. Some of them are retrieved from the database or other sources which might fail. The question is, are there any official recommendations from the developers on whether or not a try-catch clause should be included inside of Initialize method?
From what I've observed, throwing an exception inside the method doesn't prevent telemetry from appearing, though the custom properties cannot be seen, as expected. Can I rely on this behaviour? Does it somehow affect performance that I don't handle exceptions manually and let AppInsights' code handle them instead?
It depends, doesn't it. If the telemetry initializer adds multiple custom properties and the first one in line fails with an exception, do you want to try to add the others. If so, put a try/catch around each custom property.
If it is just a single property, or all should not be added as soon as the first one fails then you could choose not to handle the exception. In my opinion however, I would want to have control over the exception propagation and choose for handling them myself. (and maybe ignore them with an empty catch, depending on the situation)
Ignoring them completely may give troubles in the future when the SDK for example is altered to not send the telemetry to App Insights when a telemetry initializer fails with an unhandled exception. At least if you decide to go this route try take a peek in the source code of the SDK to see what happens with the unhandled exception.

Application Insights logs "no data for server exceptions"

I had an issue on my test server that was throwing an exception, I noticed that it logged nothing to application insights so first tried to debug on my local machine. I managed to replicate the issue, and low and behold in my DEV application insights I have server exceptions logged.
So I go back to my Test Application insights and again replicate the issue but still no errors logged (Even after an hour or so).
However I can see it logs them as "Failed Requests", just not Server Exceptions. Without the server exceptions I can't see the stacktrace/error message.
I am using the Log4Net app insights extension to log these exceptions. It's obviously not a code issue because the same code is being run in both cases. So I looked at configuration issues.
My log4net.config and applicationinsights.config have no transforms from Dev to Test (Or to prod). They stay the same.
My Web.config only has a transform to remove the debug=true as is standard.
I do set some environment properties in Azure (Using Azure Websites), but the only one that is actually application changing is the AppInsightsInstrumentation key to switch it to a different AppInsights. However I know that this key is correct because I'm logging some things, just not others.
Here's the answer (Kinda)
I was logging the exception in a Basecontroller, this worked fine on my local machine and I could debug through.
What happens though is when I push it remotely, .net's out of the box error handling kicks in. Notably the global "HandleErrorAttribute" (Check your FilterConfig.cs). This seems to capture and swallow the exception. There is lots of other talks about this if you wish to override this behaviour, mostly when talking about other logging tools like Elmah.
The reason I only see this in my test environment is because CustomErrors defaults to remoteOnly. So I only see it not logging when it's not on my machine.
Because I'm handling errors myself, I can remove this line from my FilterConfig.cs
filters.Add(new HandleErrorAttribute());
And server exceptions should be logged now (I also handle showing the user a nice error page in my BaseController for now)

WebApi application on Azure returning 500 errors for some endpoints

I am setting up an ASP.NET WebApi application running on the Azure web application environment. Most of my controllers and endpoints work fine, but there are about 10 routes that return 500 errors "An error has occured". It's not random. It's the same routes every time and I can find no pattern (not all the HTTP methods, from different controllers where other routes in that same controller work fine, and so forth)
When these errors occur, no error logging gets triggered as far as I can tell in the app. (I am using Raygun.IO if that matters). I tried adding a global.asax file with following lines in the Application_Error function:
Exception ex = Server.GetLastError();
new RaygunClient().SendInBackground(null, ex);
but as far as I can see, it doesn't get triggered when these 500 errors occur. The only thing I have found in the Azure server logs is the following warning in the Failed Requests log:
However, I don't see any errors in the trace previous to that point. I'm also not finding any other errors in any of my Azure logs that I can relate to these failing routes.
It's .NET 4.6 (tried 4.5.1 and 4.5.2 with no difference) WebApi using an OWIN startup class. Also tried updating all my packages to no effect.
Check to be sure you don't have routes that conflict. When a URI matches two or more controller actions, and thus Web API can't pick one, you will get a 500 error.
If you have a consistent repro, then you can use remote debugging to attach to your web app and debug it (https://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-troubleshoot-visual-studio/). If you can repro it through the browser, you can also turn the custom errors page off so that it shows the stack trace through the browser (<customErrors mode="off"/> under <server.web>).
Also, you can enable better diagnostic logs using the web app settings. Information on how to do so is here: https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/ under the section "Enabling diagnostic logs".
Also, as Brent said, URL conflicts can cause some nasty errors which aren't immediately obvious.
I figured out what was going on. There were actual errors occurring (mostly SQL related), but the way that we had configured the functions and error logging in those functions, the actual errors were being swallowed up and lost, overriding the error logging behavior of Raygun. I went through and ripped out the Try/Catch blocks we were using for error trapping and logging and the real errors finally emerged into the Raygun dashboard.

Getting 409 error on form submit

So am getting a 409 Conflict with Failed to load resource error. Happens when i click on a form submit of a generic Java web application.
On click of the button there is no application log shows up, just the following error shows up and the process ends. This log is from browser console.
What are the possibilities for such an issue? Any help/suggestion will be really helpful.Help on internet was not much helpful.
Interestingly this is very intermediate i.e. it happens for a device and the next time you won't see it, comes back from grave again in few hrs or so.
Let me start by saying that I have not received this error, but based on your problem statement, it seems you could be having trouble with a file lock on your server. If you are attempting to call a resource that is loaded in another tool like an IDE, then it is possible the file is locked and the server is raising this error.
You may only receive this error if your server is in development mode vs production mode. Production mode will cache the file and not result in a conflict.
Here is a link that partially explains the problem.
HTTP Error 409 Conflict
Hope this helps!!

IIS 7 500 Error Handling situation

I am on IIS 7 with a Classic ASP application using Server.GetLastError() and i added this script that writes the error details to a database as a custom '500.100' error in IIS to execute this URL. So far it's been working on most situations when there is an error in the application. However, I am noticing in the IIS log that many people are getting ASP_0147 | Internal Server Error with a 500 error and no further explanation.
I am trying to catch this error showing up in the IIS Log using the method explained above, however, these errors are not being caught (written to database) using the application i made, whereas other types of errors are being caught, but the only errors that are being caught using the script/database i made, already show up with the entire error details in the IIS log.
So the question is, how can i catch the errors still happening in the IIS Log in the database using custom errors? because the method i'm using obviously isn't catching all the errors that show in the IIS Log, only the ones with an explanation being displayed in the log. Or, if I change the Error 'Feature Settings' to 'Detailed Errors' (because now its set on, Detailed only for Local Requests) will it show up in the IIS log, etc? Why am i only seeing 500 error in the IIS Log on certain things, but not on others? Thanks.
This could be an application stall.
If the server gets a lot of requests on the same time, causing the server to "get busy", it stalls some of the requests and possibly denying them. This could give a false-positive 500 error with the error-description (0x0).

Resources