How to retrieve crash logs from Windows Phone 8 programmatically? - windows-phone-8

I have a WP8 App where I want to store the crash logs if and when generated.
Is there any way of fetching the crash dump file from Windows Phone 8 programmatically?

As far as I know, you can't retrieve the crash dumps that are automatically sent to the DevCenter. However, what you can do is subscribing to the global unhandled exception event handler, store the exception contents in the isolated storage, then do whatever you need with it (like sending it to a remote server). That's what many applications do, and it's even automated by some libraries (such as Telerik).

You can achieve that by using a logging system as MetroLog. You'll be able to collect these crash logs if you configure GlobalCrashHandler that will ensure that a FATAL log entry is written if an unhandled exception occurs.
You can install it using NuGet
Install-Package MetroLog
Here's an quick example:
using MetroLog;
using MetroLog.Targets;
LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new FileStreamingTarget());
GlobalCrashHandler.Configure();
ILogger log = LogManagerFactory.DefaultLogManager.GetLogger<MainPage>();
log.Trace("This is a trace message.");
You can find a tutorial explaining how to add it on your project at http://talkitbr.com/2015/06/11/adicionando-logs-em-universal-apps. Also there is an explanation regarding retrieving these logs.

Related

Where to find debug messages in Windows RT app?

I'm new to Win RT development and I'm currently developing a windows RT app in which I've sent a debug build of my app to the tester. I'm wondering where can I find the output of the debug messages? Would it be possible to redirect the debug output to a file?
I assume you use the system.diagnostics.debug to output the debug info.
In the desktop version .NET, you can add the Debug.Listeners to catch the log and output to file. But in the .NET for Store App, you can not add file listener.
The alternative way to log is using ETW (Event Tracing for Windows).
Code Sample: Logging Sample for Windows Store Apps (ETW Logging in WinRT)
The blog HOW TO WRITE LOG FILES IN WINDOWS STORE APPS also introduced several ways to log in Windows Store App.

Error Logging in windows Phone8 app

How can we log exceptions and error for windows Phone8.0 app
I also want a mechanism to delete the logs after a period of time
Is there a method other than ISO to log error
thanks in advance
Write them to files in isolated storage. You can write code to iterate over the file system to clean them up. If this is just for testing use Windows Phone Power Tools to manually remove logs.
An alternative is to build a logging service and have your devices connect and write to it when they have a data connection.

How to get crashdumps of Store Apps when Hang

we have a windows 8.1 app in the windows store that sometimes crashes or hangs and we are unable to receive reports about hangs and crashs reported by the user via the store.
Collecting of telemetriy data is enabled in the store like mentioned in this MSDN-Article(http://msdn.microsoft.com/en-us/library/windows/apps/hh967787.aspx).
So I did a crash of the app by myself, took a look in the WER-ReportArchive(%localappdata%\Microsoft\Windows\Windows Error Reporting) and found a .cab & .wer-file. So I think the report was sended to microsoft, but theres still no crash or hang documented in the Dashboard of the App Store.
I tried to get a crashdump via Windows Error Reporting - LocalDumps (msdn.microsoft.com/en-us/library/ bb787181%28VS.85%29.aspx), but this dump is only generated when an error occurs.
In my case mostly the app just hangs!
I also tried to configure Windows Error Report - Registry Entries (http://msdn.microsoft.com/en-us/library/bb513638%28VS.85%29.aspx), but it seems most of the entries are just ignored.
I noticed WER is creating a dump-file of AppHangs as well, before sending the data to Microsoft (memory.hdmp in ReportQueue). But this files are deleted immediately after sending.
Does somebody know a way to get memory dumps and further information for AppHangs as well?
Thanks in Advance.
I think you could use the posibility of Just-In-Time or postmortem debugging via setting registry key for AeDebug, if you can create the crash.
Have a look at:
Improving apps with Quality reports
https://blogs.msdn.microsoft.com/windowsstore/2012/06/27/improving-apps-with-quality-reports/
Debugging a Windows 8.1 Store App Crash Dump
https://blogs.msdn.microsoft.com/ntdebugging/2014/01/13/debugging-a-windows-8-1-store-app-crash-dump/
Configuring Automatic Debugging https://msdn.microsoft.com/en-us/library/bb204634(vs.85).aspx
Using WER: Collecting User-Mode Dumps https://msdn.microsoft.com/en-us/library/bb787181(v=vs.85).aspx
Enabling JIT-Attach Debugging https://msdn.microsoft.com/en-us/library/2ac5yxx6.aspx

Exception from HRESULT 0x89721200 Application Deployment tool

I am suffering from a problem trying to open the Application Deployment tool. It always gives me this error when I try to open the program:
Exception from HRESULT 0x89721200
PS: The Windows Phone developer registration cannot find my device and shows the
IpOverUsbSvc error.
How do I fix the issue?
This error can occur when the SDK's language is different to your system's language format. Try changing your system's language or else reinstalling the SDK with the same language.
First, your operating system display language, your SDK and windows Phone must have the same language.
Second, check: Are the date and time set correctly on the phone? In SETTINGS | date + time, turn off the Set automatically setting and then retry registration.
If the registration succeeds, and you have a certificate error or anything wrong then download the Preview for Developers in your phone and unlock it.

IIS 7.0 ASP.Net 3.5 Application fails when multiple users log on

I have an ASP.Net 3.5 Application hosted on Windows Server 2008 machine using IIS 7. There is a seperate application pool for this application.
The problem I have is that as soon as 2-3 users access website simultaneously, it starts throwing exceptions on almost any task performed say e.g. an exception during logging in the user using built in aspnet_membership. The same things work fine when there is only one user using it.
Any suggestions what things I need to test for?
Thanks,
Ali
I had some problem like this for some web-application, but in my case I was using IIS 6.0. After analyzing the application by means of some DevPartner tools for analyzing memory usage we realize that some components were consuming excessive resources, by replacing the toolkit we were using for simple .Net controls the applications stop crashing. Most of the crashes are due to problems in code. Also check the web config in the following points: sessionState, authentication. Disable custom errors (customErrors) to view the error details. See the application event's log to check the error description.
The first thing I do when setting up a website of this nature is to uncouple the session state from InProc to StateServer. Oftentimes I find that an application recycle or even an application level exception can cause the w3wp.exe process to crash and reload which dumps session errors. As with #Arce Brito's recommendation, you should do everything you can to find the root cause of the exception as decoupling the session will really only mask the symptom.