Trying to debug Windows Store App from dump files - c#

Let me start with my main questions, then below I will add some specifics and history. I have done research, but can't seem to fit the pieces together. Please ask for clarification before voting me down.
My questions:
Why would my Windows Store app start and run correctly locally on my Win 8.1 64 bit AND my Win 8.1 32 bit (Atom) tablet, but not start for other users?
When I get the dump file from Windows Store certification failure, how can I get the debug symbols to work so I can see more of the issue?
When I build in 'Release' mode, does it actually put the symbols into the .pdb files? And does it index the symbols?
Here's the history:
I developed a little game as a Universal app, Win Phone and Windows Store. Win Phone version is in the store, getting downloaded, and works fine.
The Windows Store version is having issues.
It runs on my machine, Win 8.1 64bit. It runs on my tablet, Win 8.1 Atom, which I install via Remote Debug from within Visual Studio. It passes the App Certification here on my box. But when I submit the package to the Windows Store it doesn't pass, and the report says it crashes when starting up. (Somehow the first appx package was released on the store, then later they replied that it crashes, so some users say the app doesn't load.)
So, I download the debug data and open up the .dmp file. I get Exception Code 0xC000027B
Digging around online, I find this is a 'Language Exception', and is a general error saying the bug was Unhandled. Following articles like this (http://blogs.msdn.com/b/ntdebugging/archive/2014/01/13/debugging-a-windows-8-1-store-app-crash-dump.aspx)
I try to get the symbols for my app to load to see if that will help. I added a folder for my app to my local symbols cache folder (c:\symbols\myApp\1.3.0.7) thinking Visual studio would pick them up, and copied the .exe, .dll, and .pdb files from the apx package that I had submitted to the store, but still get these messages:
'WER38D7.tmp.dmp' (Minidump): Loaded '*CryptoQuoteW8cs.exe'. Module was built without symbols.
'WER38D7.tmp.dmp' (CLR v4.0.30319: ): Loaded '*CryptoQuoteW8cs.exe'. No matching binary found.
'WER38D7.tmp.dmp' (CLR v4.0.30319: ): Loaded '*CryptoLogic.DLL'. No matching binary found.
A fatal exception was caught by the runtime. See $stowedexception in the Watch window to view the original exception information.
So, I'm at a loss. How do I get my app working? What error is holding it up? Why does it work and pass Certification locally, but not on the store? How can I find out? I've been all over Bing and Microsoft, and maybe I'm just not searching for the right thing. Please help!
Edit:
From windbag, I get this call stack.
combase!RoFailFastWithErrorContextInternal2(HRESULT hrError = 0xaaaaaaaa, unsigned long cStowedExceptions = 0xaaaaaaaa, struct _STOWED_EXCEPTION_INFORMATION_V2 ** aStowedExceptionPointers = 0xaaaaaaaa)+0x10a [d:\blue_gdr\com\combase\winrt\error\error.cpp # 1035]
combase!RoFailFastWithErrorContextInternal(HRESULT hrError = 0xaaaaaaaa, unsigned long cStowedExceptions = 0xaaaaaaaa, struct _STOWED_EXCEPTION_INFORMATION_V1 ** aStowedExceptionPointers = 0xaaaaaaaa)+0x10b [d:\blue_gdr\com\combase\winrt\error\error.cpp # 948]
kernel32!BaseThreadInitThunk+0xe
ntdll!__RtlUserThreadStart+0x20
ntdll!_RtlUserThreadStart+0x1b

ok, with the help of the Windbg Extension PDE.dll from Andrew Richards, I see that your application crashes because of an not handled System.UnauthorizedAccessException.
I used !PDE.dpx -dse to shows all Stowed Exceptions (those 0xC000027B exceptions):
0:006> !PDE.dpx -dse
Start memory scan : 0x0551fc7c ($csp)
End memory scan : 0x05520000 (User Stack Base)
0x0551fc94 : 0x012db914 : !dse combase!STOWED_EXCEPTION_INFORMATION_V1
0x0551fcdc : 0x0163c168 : !dse combase!STOWED_EXCEPTION_INFORMATION_V1
Now I use !PDE.dse to display its data:
0:006> !PDE.dse 0551fc94
Stowed Exception Array # 0x0551fc94
Stowed Exception #1 # 0x012db914
0x80070005 (FACILITY_WIN32 - Win32 Undecorated Error Codes): E_ACCESSDENIED - General access denied error
Stack : 0x163c528
770ba9f1 combase!RoOriginateLanguageException+0x3b
6f137872 clr!SetupErrorInfo+0x1e1
6f1fbc91 clr!MarshalNative::GetHRForException_WinRT+0x7d
>>> Associated CLR Exception <<<
Exception object: 02b424f8
Exception type: System.UnauthorizedAccessException
Message: <Invalid Object>
InnerException: <none>
StackTrace (generated):
SP IP Function
00000000 00000001 UNKNOWN!UNKNOWN+0x2
0551FC58 015702E9 CryptoQuoteW8cs!UNKNOWN+0x81
0551FC6C 01570251 CryptoQuoteW8cs!UNKNOWN+0x11
StackTraceString: <none>
HResult: 80070005
0:006> !PDE.dse 0163c168
Stowed Exception Array # 0x0163c168
Stowed Exception #1 # 0x012db914
0x80070005 (FACILITY_WIN32 - Win32 Undecorated Error Codes): E_ACCESSDENIED - General access denied error
Stack : 0x163c528
770ba9f1 combase!RoOriginateLanguageException+0x3b
6f137872 clr!SetupErrorInfo+0x1e1
6f1fbc91 clr!MarshalNative::GetHRForException_WinRT+0x7d
>>> Associated CLR Exception <<<
Exception object: 02b424f8
Exception type: System.UnauthorizedAccessException
Message: <Invalid Object>
InnerException: <none>
StackTrace (generated):
SP IP Function
00000000 00000001 UNKNOWN!UNKNOWN+0x2
0551FC58 015702E9 CryptoQuoteW8cs!UNKNOWN+0x81
0551FC6C 01570251 CryptoQuoteW8cs!UNKNOWN+0x11
StackTraceString: <none>
HResult: 80070005
Stowed Exception #2 # 0x01639748
0x80070005 (FACILITY_WIN32 - Win32 Undecorated Error Codes): E_ACCESSDENIED - General access denied error
Stack : 0x69d29c4
6d33bd5e Windows_UI_Xaml!DirectUI::Application::MainASTAInitialize+0xa9
6d33bb05 Windows_UI_Xaml!DirectUI::FrameworkView::Initialize+0x5a
6dc5a597 twinapi_appcore!Windows::ApplicationModel::Core::CoreApplicationView::CreateAndInitializeFrameworkView+0xa7
6dc5a6eb twinapi_appcore!Windows::ApplicationModel::Core::CoreApplicationView::CreateAndInitializeFrameworkView+0x1fb
74b2a83a SHCore!Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<2>,CScalingInfoBase,Microsoft::WRL::FtmBase,Microsoft::WRL::Details::Nil,Microsoft::WRL::Details::Nil,Microsoft::WRL::Details::Nil,Microsoft::WRL::Details::Nil,Microsoft::WRL::Details::Nil,Microsoft::WRL::Details::Nil,Microsoft::WRL::Details::Nil>::`vector deleting destructor'+0x189
772c919f kernel32!BaseThreadInitThunk+0xe
775a0bbb ntdll!__RtlUserThreadStart+0x20
775a0b91 ntdll!_RtlUserThreadStart+0x1b
Here you can see that the underlaying issue is the System.UnauthorizedAccessException. The dmp is only a minidump, so I can't see what CryptoQuoteW8cs!UNKNOWN+0x81 does.
Use the Application.UnhandledException event to handle exception that you have not handled via try/catch to prevent the app from crashing.
Here is a good guide on how to handle exceptions:
Strategies for Handling Errors in your Windows Store Apps

Related

Unable to load libgdiplus in Signal R web application with web sockets (Mac OS)

I downloaded this repository from GitHub and try to run it on my MacOS laptop. It uses Signal R and web sockets.
It builds, it starts, it works
But when I try to open web socket I get an error:
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibgdiplus, 0x0001): tried: 'liblibgdiplus' (no such file), '/System/Volumes/Preboot/Cryptexes/OSliblibgdiplus' (no such file), '/usr/lib/liblibgdiplus' (no such file, not in dyld cache), 'liblibgdiplus' (no such file), '/usr/local/lib/liblibgdiplus' (no such file), '/usr/lib/liblibgdiplus' (no such file, not in dyld cache)
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
I did brew install mono-libgdiplus but it didn't help.
I'm new to C# and Microsoft frameworks so what else can I do? (MacOS Ventura, Apple M1)
Solved: System.Drawing is not supported on my MacOS, so the peaces of code where this library is using should not be executed.
While the project you played with was very well designed for cross platform, it was unfortunately developed before .NET 6 introduced an important breaking change, that System.Drawing related API is only supported on Windows.
Like you found out, commenting out the lines related to System.Drawing works. But if you want similar functionalities, you will have to rewrite that part with another drawing library. There are many such options out there if search engines are used.

Project can't recognize dll in x64 machine

I need to create a Custom Download Manager, because I don't want the Internet Explorer to fire de Default File Download Dialog.
Then, I got this example to do: http://www.codeproject.com/Articles/18935/The-most-complete-C-Webbrowser-wrapper-control
I've downloaded the example code and tried to run it. after registering the DLL the program didn't recognize. The whole problem is the x64 and x86 bits thing. I work on a x64 bits machine, and it doesn't work
Then I got this post: wrap 32 bit dll for 64 bit operating system to work with regsvr32.exe
and tried the solutions, but the same exception was still there.
Exception:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in csExWB.dll
Additional information: Access denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I really need your help, and don't know what else to do. This download manager is vital to my project.
I appreciate any help.

VS2010 Strange ASP.NET Startup Errors

I have existing VS2010 ASP.NET solution which was working OK. However now when I try to run it, I get some very strange (seemingly random combination of) errors:
Invalid file name for file monitoring: '[Web App Path]\Controls' (this is a directory)
Requested registry access is not allowed. (Source: mscorlib - the call Stack says its parent higher up the stack is from System.Web.Compliation.BuildManager.ExecutePreAppStart())
System.Web.HttpException occurred / HResult=-2147467259 / Message=File does not exist.
Access to the path: 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\6c9c2bea\84b35c9c\App_Web_cyfzelmo.dll' is denied. (also
App_Browsers.dvwnc2tw.dll, App_global.asax.wtigsdou.dll)
An existing connection was forcibly closed by the remote host
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) - System.Threading.Monitor.ReliableEnter(Object obj, Boolean& lockTaken)
at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
Value cannot be null. Parameter name: source [stack parent: System.Web.Compilation.BuildManager.LoadCachedPreAppStartAssemblies(string preStartInitListPath)]
These are only shown if I have Debug/Exceptions/CLR Exceptions (Thrown) set, however I don't recall seeing them before (I usually always have this option set). I created a blank ASP.NET solution, enabled CLR Exceptions (Thrown) and also got the registry and argument null error - whenever I rebuilt and re-ran the solution.
I have recently installed VS2012 as well, but am not sure if this is a cause. I've also upgraded my Telerik controls - but my blank solution doesn't have them configured.
Any suggestions other than a repair install of VS2010? (Which I'll likely try eventually when I get the time).
The installation must have been corrupt. We re-imaged the machine and re-installed VS2010.

How to troubleshoot error: “Program stopped working APPCRASH”

I have a log and a try catch in this console app, but does not seem to get that far.
Works fine on my dev machine, does not on Win Server 2008. Event viewer has the same info as below.
I understand there's not much to go on here, but that's what I know. All prev deployments worked, so I'm at a loss.
Please don't close, and help me solve this problem. I will answer any questions I can.
Thanks.
Description:
Stopped working
Problem signature:
Problem Event Name: APPCRASH
Application Name: LoaderLive.exe
Application Version: 2.0.1.0
Application Timestamp: 4ef176d6
Fault Module Name: KERNELBASE.dll
Fault Module Version: 6.1.7601.17651
Fault Module Timestamp: 4e211319
Exception Code: e0434f4d
Exception Offset: 0000b9bc
OS Version: 6.1.7601.2.1.0.272.7
Locale ID: 1033
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
If you have a top-level try/catch and it's not catching the exception, it might be because the fault is occurring at a very low level (e.g. somewhere in a native code library), too early (before your Main even starts), or on another thread (where your try/catch can't "reach").
To find out what is going on, run the application under a debugger. If you have Visual Studio installed on the target machine, you can do it from there (open the EXE and "Start Debugging"). If not, you can use windbg.exe / cdb.exe (available as Debugging Tools for Windows in the Windows SDK). Within the debugger, you should be able to see where the fault occurs, as it will by default stop on any fatal exception.

Debugging .dmp files from WinDbg in Visual Studio 2008 for .Net managed apps

I am trying to find how to take a crash dump of a .Net managed executable and then open the resulting .dmp file in Visual Studio 2008. I want to see where in the source code the exception is thrown, the call stack and the value of variables in functions on the stack.
To simplify the problem, I've written a mini-app that crashes:
...
class Program
{
static void Main(string[] args)
{
int a = 2; //Variable I want to see value for when debugging
if (!File.Exists(#"C:\Crasher\bin\Debug\file.txt")) //Doesn't exist
throw new FileNotFoundException(); //Unhandled exception thrown
}
}
...
I did a DEBUG build and ran it from outside Visual Studio. In windbg, I clicked "Attach to Process" and selected my app. Then I typed in the windbg command window:
.dump /ma C:\crasher\bin\debug\dump.dmp
Then I opened the .dmp file in Visual Studio. I went to Tools->Options->Debugging->Symbols and added the following:
http://msdl.microsoft.com/download/symbols (saved to local folder)
This gives me symbols for all of the DLLs listed in the Modules window (e.g. Kernel32.dll, gdi32.dll - I think all of them listed are native) with the exception of mscorlib.ni.dll. The Microsoft Symbol Server gives me symbols builds and .pdbs for mscorlib.dll but NOT mscorlib.ni.dll.
When I try to load the .pdb for my .exe itself, it tells me it does not match the app. I think this is because the .exe is managed and we don't yet have symbols for all of the native code beneath it - i.e. if I could get a symbols build and pdb for mscorlib.ni.dll this would work.
Is this reasoning correct? Am I missing something else?
Either way, why is mscorlib.ni.dll not available on the Microsoft Symbol Server, where can I get symbol information and is there anything else I should know for debugging managed code through crash dumps in Visual Studio.
Many thanks - any help will be appreciated.
Phil Whittington
As Jason Evans says in his comment, this is not supported in VS2008, but you can do it in WinDbg.
The easiest way to get a correct dump for a crash like this is to use adplus (which is included in Debugging Tools for Windows). There are various options, but to get a crash dump based on the process name, you could do
>adplus -crash -o c:\dumpdirectory -pn app.exe
This will give you two dumps. One for the first chance exception and one for the second. In this case they will be virtually identical, but for a more realistic scenario the first chance exception dump will show you the state of the application when the exception was thrown (i.e. before any exception handling occur). The second chance exception dump will show you the state of the unhandled exception.
To get the exception, open the crash dump and load SOS by typing .loadby sos mscorwks.
Then use the !pe command to print the exception on the current thread (which will be the faulting thread in this case). It will look something like this:
0:000> !pe
Exception object: 024a5114
Exception type: System.IO.FileNotFoundException
Message: Unable to find the specified file.
InnerException: <none>
StackTrace (generated):
SP IP Function
0020F0F0 005100D6 TestBench!TestBench.Program.Main()+0x66
StackTraceString: <none>
HResult: 80070002
To list the local variable a use !clrstack -l, but keep in mind that locals are rarely available in a release mode builds due to optimizations.
0:000> !clrstack -l
OS Thread Id: 0x1a50 (0)
ESP EIP
0020f04c 7571b727 [HelperMethodFrame: 0020f04c]
0020f0f0 005100d6 TestBench.Program.Main()
LOCALS:
0x0020f0fc = 0x00000002 <--- the value of a
0x0020f0f8 = 0x00000000
0020f328 51141b5c [GCFrame: 0020f328]

Categories

Resources