WPF app not exiting because of UWP PdfDocument - c#

I'm trying to use the UWP Windows.Data.Pdf API from a WPF-Desktop app. It can render a PDF page to a PNG image just fine.
The issue I have is that after executing the PDF rendering, closing the WPF-Window does no longer exit the application. The process keeps running. I tried pausing the application in the debugger in this state, but no application code appears to be running. Some thread or resource must still be open, I guess.
My question here is does anybody have any idea why this happens? And furthermore, how can I debug this kind of issue?
The issue is reproducible with the empty WPF template in VS17, I added to the .csproj:
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
...
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll</HintPath>
</Reference>
<Reference Include="Windows">
<HintPath>$(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.winmd</HintPath>
</Reference>
From a simple button I'm executing this code:
using System;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Data.Pdf;
using Windows.Graphics.Imaging;
using Windows.Storage;
using Windows.Storage.Streams;
...
var filename = #"C:\Users\...\a.pdf"
var f = await StorageFile.GetFileFromPathAsync(filename);
byte[] content;
using (var stream = await f.OpenReadAsync())
{
var d = await PdfDocument.LoadFromStreamAsync(stream);
using (var page0 = d.GetPage(0))
{
await page0.PreparePageAsync();
using (var randomAccessStream = new InMemoryRandomAccessStream())
{
await page0.RenderToStreamAsync(randomAccessStream, new PdfPageRenderOptions { BitmapEncoderId = BitmapEncoder.PngEncoderId });
content = new byte[randomAccessStream.Size];
await randomAccessStream.ReadAsync(content.AsBuffer(), (uint)randomAccessStream.Size, InputStreamOptions.None);
}
}
}
File.WriteAllBytes(#"C:\Users\...\b.png", content);
This is almost the entire code, but in case I missed something I also pushed it to https://github.com/marv51/PDFRendererNotExiting
Thank you very much in advance for any help on this.
Update:
I just observed, that the process does eventually exit after about 2 minutes!
Probably related, I found in the event viewer:
Faulting application name: WpfApp3.exe, version: 1.0.0.0, time stamp: 0x5b291e3a
Faulting module name: ntdll.dll, version: 10.0.17134.1000, time stamp: 0xcfe5bd82
Exception code: 0xc0000005
Fault offset: 0x000420c8
Faulting process id: 0x1ee0
Faulting application start time: 0x01d407e07f1c3295
Faulting application path: C:\Users\ruehe\source\repos\WpfApp3\WpfApp3\bin\Release\WpfApp3.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report Id: 3a51f5ff-52b3-47fb-b00d-bf002f932c41
Faulting package full name:
Faulting package-relative application ID:
So I assume some background thread crashed during termination and Windows Error Reporting keeps the process alive to collect information. Or some kind of timeout kills open resources?
I'm sorry, I just found this. Can I do anything with this crash Information?
Update 2
After spending a lot of time on this and learning some windbg, I think this might be an Nvidia graphics driver crash:
Attaching to the app and then closing the window shows this exception:
(2134.1cac): Unknown exception - code 0000071a (first chance)
(2134.1cac): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_040c7acb04cee565\nvwgf2um.dll -
eax=00000000 ebx=0be09f10 ecx=00000013 edx=00000000 esi=00000000 edi=00000030
eip=779f38e8 esp=007decd0 ebp=007ded10 iopl=0 nv up ei pl zr na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00210246
ntdll!RtlFreeHeap+0x28:
779f38e8 817e08eeddeedd cmp dword ptr [esi+8],0DDEEDDEEh ds:002b:00000008=????????
I posted the analyze -v output here: https://gist.github.com/Marv51/d3ad0e9a49b6c985d9116600fd0475b7
From looking at the stacktrace I believe the destructor for the internal class Windows.Data.Pdf.CPdfStatics tries to release some DirectX resources and the Nvidia driver corrupts the heap during this process.
I tried updating to the latest Nvidia driver, which changed nothing.
Not sure where I can go from here. I'm still a windbg beginner, so I might interpret this output wrong.
Maybe the 'solution' for now is that I will do this work in an external process to avoid these issues from 'infecting' the main app.

Related

Windows Forms - How can I prevent a System.AccessViolationException when opening a new thread

I am hoping this issue is an obvious one to someone šŸ˜Š I have a Windows Forms application that does some independent processes on separate sub-forms. It has a MainForm that opens first and then it opens the sub-forms based on an ā€œis activeā€ database value for each sub-form. This process runs as expected often for many hours without any issuesā€¦ opening and closing when necessary. The issue that I am having trouble figuring out is one where the application just freezes and has to be manually closed and restarted which of course while it isnā€™t running stops processing altogether.
There are always 2 errors in the Windows Application error log. First is a ā€œ.Net Runtimeā€ and the second is a ā€œApplication Errorā€. There is a third Information entry that appears to be logged when the application is restarted but not 100% certain if it is present before it is restarted.
The MainForm is opening the different sub-forms in a new thread using different versions of this:
try
{
Thread CS = new Thread(new ThreadStart(CS_Start));
CS.SetApartmentState(ApartmentState.STA);
CS.Start();
}
catch { }
And this is the code it is called in the new thread which is opens one of the sub-formsā€¦
private void CS_Start ()
{
try
{
using (CS_Searches CS_SearchForm = new CS_Searches())
{
if (!CS_SearchForm.Visible)
CS_SearchForm.ShowDialog();
}
}
catch { }
}
There are 5 separate forms that the MainForm opens. Each form does completely separate tasks and will also close itself based on the ā€œis activeā€ value using: this.Dispose();
The issue seems to always occur at the different CS.Start(); lines. I have tried catching the error but unfortunately it never hits this code. Iā€™ve also modified the CS_Start by adding the using statement. Unfortunately I havenā€™t been able to replicate the issue as it runs great until it doesnā€™t and the frequency can be all over the map. Based on all my Googling it appears to be a memory access violation but I am having no luck confirming this or finding a fix. Any assistance would be greatly appreciated.
Thanks,
Greg
These are the error log details:
Error - .Net Runtime
Application: OA.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Reflection.TargetInvocationException
Stack:
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
at OA.MainForm.CS_Start()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
Error - Application Error
Faulting application name: OA.exe, version: 1.0.0.0, time stamp: 0x5d7835c6
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18015, time stamp: 0x50b8479b
Exception code: 0xe0434352
Fault offset: 0x0000000000009e5d
Faulting process id: 0xed0
Faulting application start time: 0x01d5683c859e21b3
Faulting application path: C:\! OA\OA.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: f77be558-d4a1-11e9-a767-00505691533d
Information - Windows Error Reporting
Fault bucket , type 0
Event Name: CLR20r3
Response: Not available
Cab Id: 0
Problem signature:
P1: OA.exe
P2: 1.0.0.0
P3: 5d793cd6
P4: System.Windows.Forms
P5: 4.0.30319.17929
P6: 4ffa5c0e
P7: 4cba
P8: 27
P9: System.AccessViolationException
P10:
Attached files:
These files may be available here:
C:\Users\AUTO.WERHQ\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_oa_c95e0af449b9b5070e88c537a95b8ce90dee049_25993682
Analysis symbol:
Rechecking for solution: 0
Report Id: bbe1964a-d56f-11e9-a767-00505691533d
Report Status: 0
Information - Windows Error Reporting ā€“ Report File above content
Version=1
EventType=CLR20r3
EventTime=132127743632961454
ReportType=2
Consent=1
ReportIdentifier=d5c9cb47-d56e-11e9-a767-00505691533d
IntegratorReportIdentifier=d5c9cb46-d56e-11e9-a767-00505691533d
Response.type=4
Sig[0].Name=Problem Signature 01
Sig[0].Value=OA.exe
Sig[1].Name=Problem Signature 02
Sig[1].Value=1.0.0.0
Sig[2].Name=Problem Signature 03
Sig[2].Value=5d793cd6
Sig[3].Name=Problem Signature 04
Sig[3].Value=System.Windows.Forms
Sig[4].Name=Problem Signature 05
Sig[4].Value=4.0.30319.17929
Sig[5].Name=Problem Signature 06
Sig[5].Value=4ffa5c0e
Sig[6].Name=Problem Signature 07
Sig[6].Value=4cba
Sig[7].Name=Problem Signature 08
Sig[7].Value=27
Sig[8].Name=Problem Signature 09
Sig[8].Value=System.AccessViolationException
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=6.1.7601.2.1.0.256.48
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
DynamicSig[22].Name=Additional Information 1
DynamicSig[22].Value=276c
DynamicSig[23].Name=Additional Information 2
DynamicSig[23].Value=276cb04a1eafd1e19b2fc54286fd4e13
DynamicSig[24].Name=Additional Information 3
DynamicSig[24].Value=b00b
DynamicSig[25].Name=Additional Information 4
DynamicSig[25].Value=b00bccb4ee23035129f9f2009e37821c
UI[2]=C:\! OA\OA.exe
UI[3]=OA has stopped working
UI[4]=Windows can check online for a solution to the problem.
UI[5]=Check online for a solution and close the program
UI[6]=Check online for a solution later and close the program
UI[7]=Close the program
LoadedModule[0]=C:\! OA\OA.exe
LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll
LoadedModule[2]=C:\Windows\SYSTEM32\MSCOREE.DLL
LoadedModule[3]=C:\Windows\system32\KERNEL32.dll
LoadedModule[4]=C:\Windows\system32\KERNELBASE.dll
LoadedModule[5]=C:\Windows\system32\ADVAPI32.dll
LoadedModule[6]=C:\Windows\system32\msvcrt.dll
LoadedModule[7]=C:\Windows\SYSTEM32\sechost.dll
LoadedModule[8]=C:\Windows\system32\RPCRT4.dll
LoadedModule[9]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll
LoadedModule[10]=C:\Windows\system32\SHLWAPI.dll
LoadedModule[11]=C:\Windows\system32\GDI32.dll
LoadedModule[12]=C:\Windows\system32\USER32.dll
LoadedModule[13]=C:\Windows\system32\LPK.dll
LoadedModule[14]=C:\Windows\system32\USP10.dll
LoadedModule[15]=C:\Windows\system32\IMM32.DLL
LoadedModule[16]=C:\Windows\system32\MSCTF.dll
LoadedModule[17]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
LoadedModule[18]=C:\Windows\system32\MSVCR110_CLR0400.dll
LoadedModule[19]=C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\9da5bb33cd1c34b7851c088f0cf749cc\mscorlib.ni.dll
LoadedModule[20]=C:\Windows\system32\ole32.dll
LoadedModule[21]=C:\Windows\system32\CRYPTBASE.dll
LoadedModule[22]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll
LoadedModule[23]=C:\Windows\system32\OLEAUT32.dll
LoadedModule[24]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System\d191674dfd2e0fb89abf108445359453\System.ni.dll
LoadedModule[25]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Drawing\fe0b5caab219a62708e42ad3ab7f0440\System.Drawing.ni.dll
LoadedModule[26]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\3fac3f0dccd0fdc80be79bd7fcf2261a\System.Windows.Forms.ni.dll
LoadedModule[27]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Configuration\3dd1bdef318925394a5f51fb254b7004\System.Configuration.ni.dll
LoadedModule[28]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Core\8ae856324ba290331c8d1442b3321a22\System.Core.ni.dll
LoadedModule[29]=C:\Windows\assembly\NativeImages_v4.0.30319_64\Microsoft.CSharp\fc2e811c0a4fbcb589f7775a25c7377a\Microsoft.CSharp.ni.dll
LoadedModule[30]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\nlssorting.dll
LoadedModule[31]=C:\Windows\system32\CRYPTSP.dll
LoadedModule[32]=C:\Windows\system32\rsaenh.dll
LoadedModule[33]=C:\Windows\system32\uxtheme.dll
LoadedModule[34]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Xml\7a54d4ebaa554c877a48c06148506a0e\System.Xml.ni.dll
LoadedModule[35]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Runteb92aa12#\29ffe930d3112e330be0c61b4f83bf5a\System.Runtime.Serialization.ni.dll
LoadedModule[36]=C:\Windows\system32\ws2_32.dll
LoadedModule[37]=C:\Windows\system32\NSI.dll
LoadedModule[38]=C:\Windows\system32\mswsock.dll
LoadedModule[39]=C:\Windows\System32\wshtcpip.dll
LoadedModule[40]=C:\Windows\System32\wship6.dll
LoadedModule[41]=C:\Windows\system32\NLAapi.dll
LoadedModule[42]=C:\Windows\system32\napinsp.dll
LoadedModule[43]=C:\Windows\system32\pnrpnsp.dll
LoadedModule[44]=C:\Windows\system32\DNSAPI.dll
LoadedModule[45]=C:\Windows\System32\winrnr.dll
LoadedModule[46]=C:\Windows\system32\IPHLPAPI.DLL
LoadedModule[47]=C:\Windows\system32\WINNSI.DLL
LoadedModule[48]=C:\Windows\system32\rasadhlp.dll
LoadedModule[49]=C:\Windows\System32\fwpuclnt.dll
LoadedModule[50]=C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_a4d6a923711520a9\comctl32.dll
LoadedModule[51]=C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\comctl32.dll
LoadedModule[52]=C:\Windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17825_none_2b253c8271ec7765\gdiplus.dll
LoadedModule[53]=C:\Windows\system32\wininet.dll
LoadedModule[54]=C:\Windows\system32\api-ms-win-downlevel-user32-l1-1-0.dll
LoadedModule[55]=C:\Windows\system32\api-ms-win-downlevel-shlwapi-l1-1-0.dll
LoadedModule[56]=C:\Windows\system32\api-ms-win-downlevel-version-l1-1-0.dll
LoadedModule[57]=C:\Windows\system32\version.DLL
LoadedModule[58]=C:\Windows\system32\api-ms-win-downlevel-normaliz-l1-1-0.dll
LoadedModule[59]=C:\Windows\system32\normaliz.DLL
LoadedModule[60]=C:\Windows\system32\iertutil.dll
LoadedModule[61]=C:\Windows\system32\api-ms-win-downlevel-advapi32-l1-1-0.dll
LoadedModule[62]=C:\Windows\system32\USERENV.dll
LoadedModule[63]=C:\Windows\system32\profapi.dll
LoadedModule[64]=C:\Windows\system32\Secur32.dll
LoadedModule[65]=C:\Windows\system32\SSPICLI.DLL
LoadedModule[66]=C:\Windows\system32\SHELL32.dll
LoadedModule[67]=C:\Windows\system32\api-ms-win-downlevel-advapi32-l2-1-0.dll
LoadedModule[68]=C:\Windows\system32\api-ms-win-downlevel-ole32-l1-1-0.dll
LoadedModule[69]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.ServiceModel\b6c60909860ace07b6b6617c71d089ff\System.ServiceModel.ni.dll
LoadedModule[70]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Servd1dec626#\ca7c2fd7257e0452df4a39ec969e8913\System.ServiceModel.Internals.ni.dll
LoadedModule[71]=C:\Windows\assembly\NativeImages_v4.0.30319_64\SMDiagnostics\7ce23442406c8bff478964ae214251b5\SMDiagnostics.ni.dll
LoadedModule[72]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Serv30e99c02#\fe0b22eaecf87715a043c1c76884bae6\System.ServiceModel.Channels.ni.dll
LoadedModule[73]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Servf73e6522#\0e0f2d16bef2c0e1dd62edff4b3cf02c\System.ServiceModel.Web.ni.dll
LoadedModule[74]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.IdentityModel\7b2df4768784cae3f8714f1ececbe25a\System.IdentityModel.ni.dll
LoadedModule[75]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Net.Http\8653972f8d9923f44566604ae0de1aea\System.Net.Http.ni.dll
LoadedModule[76]=C:\Windows\system32\rasapi32.dll
LoadedModule[77]=C:\Windows\system32\rasman.dll
LoadedModule[78]=C:\Windows\system32\rtutils.dll
LoadedModule[79]=C:\Windows\system32\winhttp.dll
LoadedModule[80]=C:\Windows\system32\webio.dll
LoadedModule[81]=C:\Windows\system32\credssp.dll
LoadedModule[82]=C:\Windows\system32\dhcpcsvc6.DLL
LoadedModule[83]=C:\Windows\system32\dhcpcsvc.DLL
LoadedModule[84]=C:\Windows\system32\CFGMGR32.dll
LoadedModule[85]=C:\Windows\system32\RpcRtRemote.dll
LoadedModule[86]=C:\Windows\system32\WindowsCodecs.dll
LoadedModule[87]=C:\! OA\OpenPop.dll
LoadedModule[88]=C:\Windows\system32\bcrypt.dll
LoadedModule[89]=C:\Windows\system32\CLBCatQ.DLL
LoadedModule[90]=C:\Windows\System32\ieframe.dll
LoadedModule[91]=C:\Windows\System32\api-ms-win-downlevel-shell32-l1-1-0.dll
LoadedModule[92]=C:\Windows\system32\SXS.DLL
LoadedModule[93]=C:\Windows\system32\api-ms-win-downlevel-shlwapi-l2-1-0.dll
LoadedModule[94]=C:\Windows\system32\PROPSYS.dll
LoadedModule[95]=C:\Windows\system32\apphelp.dll
LoadedModule[96]=C:\Windows\system32\urlmon.dll
LoadedModule[97]=C:\Windows\system32\CRYPT32.dll
LoadedModule[98]=C:\Windows\system32\MSASN1.dll
LoadedModule[99]=C:\Windows\system32\MSHTML.dll
LoadedModule[100]=C:\Windows\System32\netprofm.dll
LoadedModule[101]=C:\Windows\System32\npmproxy.dll
LoadedModule[102]=C:\Windows\system32\schannel.DLL
LoadedModule[103]=C:\Windows\system32\ncrypt.dll
LoadedModule[104]=C:\Windows\system32\bcryptprimitives.dll
LoadedModule[105]=C:\Windows\system32\WINTRUST.dll
LoadedModule[106]=C:\Windows\system32\GPAPI.dll
LoadedModule[107]=C:\Windows\system32\cryptnet.dll
LoadedModule[108]=C:\Windows\system32\WLDAP32.dll
LoadedModule[109]=C:\Windows\system32\SensApi.dll
LoadedModule[110]=C:\Windows\system32\MLANG.dll
LoadedModule[111]=C:\Windows\System32\jscript9.dll
LoadedModule[112]=C:\Windows\system32\msimtf.dll
LoadedModule[113]=C:\Windows\system32\d2d1.dll
LoadedModule[114]=C:\Windows\system32\DWrite.dll
LoadedModule[115]=C:\Windows\system32\dxgi.dll
LoadedModule[116]=C:\Windows\system32\dwmapi.dll
LoadedModule[117]=C:\Windows\system32\d3d11.dll
LoadedModule[118]=C:\Windows\system32\D3D10Warp.dll
LoadedModule[119]=C:\Windows\system32\WINMM.dll
LoadedModule[120]=C:\Windows\system32\MMDevAPI.DLL
LoadedModule[121]=C:\Windows\system32\ntmarta.dll
LoadedModule[122]=C:\Windows\system32\SETUPAPI.dll
LoadedModule[123]=C:\Windows\system32\DEVOBJ.dll
LoadedModule[124]=C:\Windows\system32\OLEACC.DLL
LoadedModule[125]=C:\Windows\system32\uiautomationcore.dll
LoadedModule[126]=C:\Windows\system32\PSAPI.DLL
LoadedModule[127]=C:\Windows\system32\ImgUtil.dll
LoadedModule[128]=C:\Program Files\Internet Explorer\ieproxy.dll
LoadedModule[129]=C:\Windows\System32\UIAnimation.dll
LoadedModule[130]=C:\Windows\system32\T2EMBED.DLL
LoadedModule[131]=C:\Windows\System32\msxml3.dll
LoadedModule[132]=C:\Windows\system32\XmlLite.dll
LoadedModule[133]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll
FriendlyEventName=Stopped working
ConsentKey=CLR20r3
AppName=OA
AppPath=C:\! OA\OA.exe
This is really interesting to explore - you may go with making dumps and exploring them with WInDbg. But I would consider creating the same application as Console Application and exploring its behavior. It may turn out it was some kind GUI related bug/feature where you reached maybe Handlers/GDI limit or something like this.

App crashes at startup, KERNELBASE.dll, Exception Code e0434352

My C# / WinForms app crashes at startup.
I went through several posts here that cover that topic but I wasn't able to solve the problem yet.
That is the error I get:
Problemsignature:
Problemeventname: APPCRASH
Applicationname: MyApp.exe
Applicationversion: 1.0.0.0
Applicationtimestamp: 5b4c47c9
Faultedmodulename: KERNELBASE.dll
Faultedmoduleversion: 6.1.7601.24150
Faultedmoduletimestamp: 5b0cbc65
Exceptioncode: e0434352
Exceptionoffset: 000000000001a06d
Operatingsystemversion: 6.1.7601.2.1.0.272.7
Location-ID: 1031
Additionalinformation 1: 367e
Additionalinformation 2: 367e805d0e7c1ec3f63b05bb5ce5c416
Additionalinformation 3: 5a60
Additionalinformation 4: 5a6090e598b447a9043f485266c8e273
I searched for more detailed logs and found this:
Version=1
EventType=APPCRASH
EventTime=131762111243226835
ReportType=2
Consent=1
ReportIdentifier=6925141c-88e4-11e8-a994-000c2920c559
IntegratorReportIdentifier=6925141b-88e4-11e8-a994-000c2920c559
Response.type=4
Sig[0].Name=Applicationname
Sig[0].Value=MyApp.exe
Sig[1].Name=Applicationversion
Sig[1].Value=1.0.0.0
Sig[2].Name=Applicationtimestamp
Sig[2].Value=5b4c47c9
Sig[3].Name=Faultedmodulename
Sig[3].Value=KERNELBASE.dll
Sig[4].Name=Faultedmoduleversion
Sig[4].Value=6.1.7601.24150
Sig[5].Name=Faultedmoduletimestamp
Sig[5].Value=5b0cbc65
Sig[6].Name=Exceptioncode
Sig[6].Value=e0434352
Sig[7].Name=Exceptionoffset
Sig[7].Value=000000000001a06d
DynamicSig[1].Name=Operatingsystemversion
DynamicSig[1].Value=6.1.7601.2.1.0.272.7
DynamicSig[2].Name=Location-ID
DynamicSig[2].Value=1031
DynamicSig[22].Name=Additionalinformation 1
DynamicSig[22].Value=367e
DynamicSig[23].Name=Additionalinformation 2
DynamicSig[23].Value=367e805d0e7c1ec3f63b05bb5ce5c416
DynamicSig[24].Name=Additionalinformation 3
DynamicSig[24].Value=5a60
DynamicSig[25].Name=Additionalinformation 4
DynamicSig[25].Value=5a6090e598b447a9043f485266c8e273
UI[2]=C:\Program Files\MyApp\MyApp.exe
UI[3]=MyApp stopped working
UI[4]=Windows can look online for a solution to the problem.
UI[5]=Search online for a solution and close the program
UI[6]=Search for a solution online later and close the program
UI[7]=Close the program
LoadedModule[0]=C:\Program Files\MyApp\MyApp.exe
LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll
LoadedModule[2]=C:\Windows\SYSTEM32\MSCOREE.DLL
LoadedModule[3]=C:\Windows\system32\KERNEL32.dll
LoadedModule[4]=C:\Windows\system32\KERNELBASE.dll
LoadedModule[5]=C:\Windows\system32\ADVAPI32.dll
LoadedModule[6]=C:\Windows\system32\msvcrt.dll
LoadedModule[7]=C:\Windows\SYSTEM32\sechost.dll
LoadedModule[8]=C:\Windows\system32\RPCRT4.dll
LoadedModule[9]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll
LoadedModule[10]=C:\Windows\system32\SHLWAPI.dll
LoadedModule[11]=C:\Windows\system32\GDI32.dll
LoadedModule[12]=C:\Windows\system32\USER32.dll
LoadedModule[13]=C:\Windows\system32\LPK.dll
LoadedModule[14]=C:\Windows\system32\USP10.dll
LoadedModule[15]=C:\Windows\system32\IMM32.DLL
LoadedModule[16]=C:\Windows\system32\MSCTF.dll
LoadedModule[17]=C:\PROGRA~2\Sophos\SOPHOS~1\SOPHOS~2.DLL
LoadedModule[18]=C:\Windows\system32\PSAPI.DLL
LoadedModule[19]=C:\Windows\system32\VERSION.dll
LoadedModule[20]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
LoadedModule[21]=C:\Windows\system32\MSVCR120_CLR0400.dll
LoadedModule[22]=C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\ccb48f84a5cca36e9b0205b6a65ee54a\mscorlib.ni.dll
LoadedModule[23]=C:\Windows\system32\ole32.dll
LoadedModule[24]=C:\Windows\system32\CRYPTBASE.dll
LoadedModule[25]=C:\Program Files (x86)\TeamViewer\tv_x64.dll
LoadedModule[26]=C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18837_none_a4d981ff711297b6\COMCTL32.dll
LoadedModule[27]=C:\Windows\system32\SHELL32.dll
LoadedModule[28]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll
LoadedModule[29]=C:\Windows\system32\CRYPTSP.dll
LoadedModule[30]=C:\Windows\system32\rsaenh.dll
LoadedModule[31]=C:\Windows\system32\RpcRtRemote.dll
LoadedModule[32]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System\4575f30d7b13f1377c287e162ba3147e\System.ni.dll
LoadedModule[33]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Drawing\3b5c30aa581d90fd18f9593f9c842b6d\System.Drawing.ni.dll
LoadedModule[34]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\7a911b66e6652a094625f0ce974dc434\System.Windows.Forms.ni.dll
LoadedModule[35]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll
FriendlyEventName=No longer functional
ConsentKey=APPCRASH
AppName=MyApp
AppPath=C:\Program Files\MyApp\MyApp.exe
However, that doesn't really help me. I've checked the startup of the app in debug mode (different machine) where I am able to run it and logged the loaded assemblies. I went over each assembly and checked whether it was available on the other machine. Everything was there, although some assemblies are not available in the GAC but in the apps directory.
I have no idea where to look now, thanks for your help!
Edit: I get this message in the event viewer:
Anwendung: MyApp.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.IO.FileLoadException
bei MyApp.Program.Main()
Is there a way to get more information which assembly is missing?
I solved my issue by checking the versions of the referenced assembly. One third-party assembly had a minor update which I forgot to update in my clients folder.

Exception when StreamInsight 2.3 is running

I have StreamInsight client:
var quoteStreamable = application.GetStreamable<IntradayQuote>(symbol);
var matchQuery = from quote in quoteStreamable.ToObservable()
where quote.Symbol == symbol
select new MatchPairs
{
Quote = quote,
Order = order
};
var sink =
application.GetObserver<MatchPairs>(StreamInsightConfiguration.Default.StreamInsightServerSinkName);
var clientProcessName = WindowsServiceUtility.InitClientProcessName(order.Id, symbol);
if (!application.Entities.ContainsKey(clientProcessName))
{
using (matchQuery.Bind(sink).Run(clientProcessName))
{
.....
}
}
I have 100 clients. When I run 100 clients, the StreamInsight will be crashed.
Here is exception in event viewer:
Source: Application Error:
Faulting application name: StreamInsightService.exe, version: 1.0.0.0, time stamp: 0x57b1459b
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0x80131623
Fault offset: 0x12f99e0f
Faulting process id: 0x27dc
Faulting application start time: 0x01d1f6aec2a424b6
Faulting application path: C:\WorkSpace\bin\Debug\StreamInsightService.exe
Faulting module path: unknown
Report Id: ec7c65ff-62a3-11e6-80be-408d5c3df51a
Faulting package full name:
Faulting package-relative application ID:*
Source: .NET Runtime:
Application: StreamInsightService.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Only started or running tasks can be suspended.
Parameter name: task
Stack:
at System.Environment.FailFast(System.String)
at Microsoft.ComplexEventProcessing.Engine.InstanceManager.FilterException(System.Exception)
at Microsoft.ComplexEventProcessing.Engine.InstanceManager.ProcessCommand(Microsoft.ComplexEventProcessing.Engine.SystemCommand, Int64)
at Microsoft.ComplexEventProcessing.Engine.InstanceManagerInputStrategy.DispatchEvents(Microsoft.ComplexEventProcessing.Engine.SchedulingPolicy)
at Microsoft.ComplexEventProcessing.Engine.SchedulingPolicy.DispatchEvents()
at Microsoft.ComplexEventProcessing.Engine.DataflowTask.OnRun()
at Microsoft.ComplexEventProcessing.StreamOS.Task.Run()
at Microsoft.ComplexEventProcessing.StreamOS.Scheduler.Main()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
How to fix this problem ? or let me know what is the reason about above exception ?

Stopping IIS Application Pool c#

I am trying to stop a remote system's IIS application pool using the following c# code:
try
{
// Assign a variable to store the Connection Options
var connection = new ConnectionOptions();
// Connect as this user
connection.Username = Globals.AdminUsername;
// Connect with this password
connection.Password = Globals.AdminPassword;
// Connect using this domain
connection.Authority = "ntlmdomain:MyDomain";
// Gets or sets a value indicating whether user privileges
// need to be enabled for the connection operation.
connection.EnablePrivileges = true;
// Enable impersonation so non admins can run admin level commands
connection.Impersonation = ImpersonationLevel.Impersonate;
//Each data packet is signed and encrypted. This helps protect
// the entire communication between the client and server.
connection.Authentication = AuthenticationLevel.PacketPrivacy;
// Define a WMI management scope
var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\MicrosoftIISv2", ServerName), connection);
string objPath = "IISApplicationPool.Name='W3SVC/AppPools/" + AppPoolName + "'";
// Run the query using the scope defined above
using (ManagementObject AppPool = new ManagementObject(wmiScope,new ManagementPath(objPath), null))
{
switch (Action)
{
case "Start":
AppPool.InvokeMethod("Start", null, null);
break;
case "Stop":
AppPool.InvokeMethod("Stop", null, null);
break;
case "Recycle":
AppPool.InvokeMethod("Recycle", null, null);
break;
}
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
If I stop my application pool it works, but I get a bunch of errors on the server:
-----
The root\MicrosoftIISv2 namespace is marked with the RequiresEncryption flag.
Access to this namespace might be denied if the script or application does not have the
appropriate authentication level. Change the authentication level to Pkt_Privacy
and run the script or application again.
-----
-----
An unhandled exception occurred and the process was terminated.
Application ID: DefaultDomain
Process ID: 1640
Exception: System.AppDomainUnloadedException
Message: Attempted to access an unloaded AppDomain.
StackTrace:
-----
-----
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Configuration.ConfigurationErrorsException
Stack:
at System.Diagnostics.TraceUtils.GetRuntimeObject(System.String, System.Type, System.String)
-----
-----
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7a5f8
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18409, time stamp: 0x53159a86
Exception code: 0xe0434352
Fault offset: 0x0000c42d
Faulting process id: 0x668
Faulting application start time: 0x01d194020cab3c08
Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: 57bb8e2a-fff5-11e5-8ddc-005056a330b1
-----
I'm pretty sure that I shouldn't be getting these errors because if I manually (vs programmatically) start/stop the application pool I don't get these warnings or errors.
Can anyone help me understand why I'm getting these errors. I am setting Packet_Privacy I think so that warning doesn't make sense to me.
Thanks
Brad

Firefox crash when I run selenium unit test

I start use Selenium.WebDriver (v2.45) to run visual tests.
As web driver I use FirefoxDriver. I have installed Firefox 38. When I try run test firefox return exception with message:
FF has stopped working.
Does anyone have any suggestions? It worked in previous week, is it possible that my test was crashed by updated?
Problem signature:
Problem Event Name: APPCRASH
Application Name: Firefox.exe
Application Version: 38.0.1.5611
Application Timestamp: 55540a1a
Fault Module Name: xul.dll
Fault Module Version: 38.0.1.5611
Fault Module Timestamp: 55541969
Exception Code: c0000005
Exception Offset: 0035669b
OS Version: 6.3.9600.2.0.0.16.7
Locale ID: 1033
Additional Information 1: 5861
Additional Information 2: 5861822e1919d7c014bbb064c64908b2
Additional Information 3: a10f
Additional Information 4: a10ff7d2bb2516fdc753f9c34fc3b069
There is my test method body:
[Fact]
public void ShouldLoginForTestAccount()
{
var driver = new FirefoxDriver();
driver.Manage().Cookies.DeleteAllCookies();
driver.Navigate().GoToUrl(LoginPage);
driver.FindElementById("Login")
.SendKeys("correctLogin");
driver.FindElementById("Password")
.SendKeys("correctPassword");
driver.FindElementByTagName("button")
.Click();
Assert.Equal(TestingProjectUrl, driver.Url);
driver.Close();
}
Selenium 2.45 does not reliably work with Firefox 38 due to compatibility issues.
Downgrade Firefox to 35 (link to 35.0.1).
I have a suggestion.
I was getting the error bellow when I called Quit() method of WebDriver.
unknown software exception (0x80000003) em 0x55fdec79
So I created the WebDriver as follow:
FirefoxOptions foxOptions = new FirefoxOptions();
foxOptions.SetPreference("dom.allow_scripts_to_close_windows", true);
driver = new ThreadLocal<IWebDriver>(() => { return new FirefoxDriver(service as FirefoxDriverService, foxOptions, new TimeSpan(0, 1, 0)); }).Value;
Then, before call Quit() method, I execute one javascript to close the main window:
try { ((IJavaScriptExecutor)driver).ExecuteScript("window.close();"); } catch { }
So now I'm able to call Quit() without get any error. I know that this is a workaround, but I think this can help you.

Categories

Resources