{"id":16585,"date":"2017-12-22T15:00:00","date_gmt":"2017-12-22T15:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/?p=16585"},"modified":"2019-03-01T13:54:04","modified_gmt":"2019-03-01T20:54:04","slug":"application-insights-debug-snapshot-issue-unexpected-error-has-occurred","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/application-insights-debug-snapshot-issue-unexpected-error-has-occurred\/","title":{"rendered":"Application Insights Debug Snapshot issue \u201cUnexpected error has occurred\u201d"},"content":{"rendered":"<p>This post on the Debug Snapshot feature of Application Insights comes to us from Premier Developer consultant <a href=\"https:\/\/www.linkedin.com\/in\/adel-ghabboun-44082916\/\" target=\"_blank\" rel=\"noopener\">Adel Ghabboun<\/a>.<\/p>\n<hr \/>\n<p>A couple of days ago, I encountered an ambiguous issue while trying to open the debug snapshot feature in Application Insights following <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/application-insights\/app-insights-snapshot-debugger\">Debug snapshots on exceptions in .NET apps<\/a>.<\/p>\n<p>The error was \u201c<i><u>Unexpected error has occurred. We are currently having issues with this request. Please open this page again and try again, if problem persists please file a support ticket or contact us directly<\/u><\/i>\u201d as shown below:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-35652\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2017\/12\/debug1.jpg\" alt=\"\" width=\"264\" height=\"325\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2017\/12\/debug1.jpg 264w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2017\/12\/debug1-244x300.jpg 244w\" sizes=\"(max-width: 264px) 100vw, 264px\" \/><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0013.png\"><img decoding=\"async\" title=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image001_thumb2.png\" alt=\"clip_image001\" width=\"78\" height=\"124\" border=\"0\" \/><\/a>\u00a0<img decoding=\"async\" class=\"alignnone size-full wp-image-35653\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2017\/12\/debug3.jpg\" alt=\"\" width=\"507\" height=\"183\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2017\/12\/debug3.jpg 507w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2017\/12\/debug3-300x108.jpg 300w\" sizes=\"(max-width: 507px) 100vw, 507px\" \/><\/p>\n<p>I was working on a test application to try out the Remote debug feature in Azure Application Insights, where I immediately stopped running the application right after the exception was caught in the <b>Try &#8230; Catch <\/b>block (code is similar to this):<\/p>\n<pre>TelemetryClient client = new TelemetryClient();\r\ntry\r\n{\r\nvar num1 = 10;\r\nvar num2 = 0;\r\nvar result = num1 \/ num2;\r\n}\r\ncatch (Exception e)\r\n{\r\nvar properties = new Dictionary&lt;string, string&gt;\r\n{{\"User\", \"ADEL\"}};\r\n\r\n\u00a0\r\n\r\nvar measurements = new Dictionary&lt;string, double&gt;\r\n{{\"Location\", 3 }};\r\n\r\n\u00a0\r\n\r\nclient.TrackException(e,properties,measurements);\r\n}<\/pre>\n<p>After troubleshooting the issue, there was a log file \u201cUploader.log\u201d generated under <em>%TEMP%\\Dumps\\&lt;ikey&gt;<\/em> where it captured all my application logs.<\/p>\n<p>When the application was exiting, it caused the MinidumpUplaoder.exe to exit before it had a chance to upload the snapshot minidump (.dmp) files.<\/p>\n<p>The MinidumpUploader process is launched from your application and will exit when your application exits \u2013 even if there are .dmp files that haven\u2019t been uploaded. So that means the snapshot was still in <b>Waiting<\/b> state to be uploaded next time I run my application.<\/p>\n<p>This is what my Uploader.log looked like:<\/p>\n<p><em>MinidumpUploader.exe Information: 0 : Parent process exited. Cancelling.\nDateTime=2017-10-31T16:32:19.6943437Z\nMinidumpUploader.exe Information: 0 : Snapshot uploader exiting.\nDateTime=2017-10-31T16:32:19.6953440Z<\/em><\/p>\n<p>That says a snapshot was created, but MinidumpUploader.exe exited before the .dmp file for that snapshot was ready. And then I launched my application again and checked the uploader file<\/p>\n<p><em>MinidumpUploader.exe Information: 0 : Snapshot uploader successfully started. Watching folder \u2026..\\Temp\\Dumps\\[iKey] for new dump files.\nDateTime=2017-10-31T16:33:23.6246308Z<\/em><\/p>\n<p>Looks like the .dmp file from previous run was discovered:<\/p>\n<p><em>MinidumpUploader.exe Information: 0 : Scheduled 1 left-over dump file(s) for upload.\nDateTime=2017-10-31T16:33:23.7481321Z<\/em><\/p>\n<p><b><u>To solve this issue<\/u><\/b>, the application needs to be launched again, and wait for MinidumpUploader to finish uploading those remaining .dmp files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post on the Debug Snapshot feature of Application Insights comes to us from Premier Developer consultant Adel Ghabboun. A couple of days ago, I encountered an ambiguous issue while trying to open the debug snapshot feature in Application Insights following Debug snapshots on exceptions in .NET apps. The error was \u201cUnexpected error has occurred. [&hellip;]<\/p>\n","protected":false},"author":581,"featured_media":37840,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[13,81],"class_list":["post-16585","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-permierdev","tag-adel-ghabboun","tag-application-insights"],"acf":[],"blog_post_summary":"<p>This post on the Debug Snapshot feature of Application Insights comes to us from Premier Developer consultant Adel Ghabboun. A couple of days ago, I encountered an ambiguous issue while trying to open the debug snapshot feature in Application Insights following Debug snapshots on exceptions in .NET apps. The error was \u201cUnexpected error has occurred. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/16585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=16585"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/16585\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/37840"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=16585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=16585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=16585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}