I am facing a very weird problem after releasing a application which is developed in c#.NET version 4.0 (client profile)
Actually, application open a word file using office interop. File gets open and as I started typing (modifying header text) in file app gets crashed. I spend 2-3 days to find reason behind app crash.
Here is what I collected from event viewer:
Source: .NET Runtime
Application: OES-PracticalClient.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32)
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.Application.Run(System.Windows.Forms.Form)
at Secure_Browser_CS_Version.Program.Main()
Source : Application Error
Faulting application name: OES-PracticalClient.exe, version: 1.0.0.4, time stamp: 0x5725e4d6
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x000d0000
Faulting process id: 0xe44
Faulting application start time: 0x01d1b1cc5b6d0f8d
Faulting application path: C:\Program Files\myorg\product name\OES-PracticalClient.exe
Faulting module path: unknown
Report Id: 029300ed-1dc0-11e6-a33d-080027beb5a6
Report.wer file is uploaded here.
By event log it's clear that it's something related to access violation with interop (clear me if I am wrong) due to stack trace at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32)
, but I am not able to identify what causing crash. Specially after I started typing.
Moreover on development,testing machine and client machine is having same OS and office version, but app crash is not happened on development and testing enviroment.
Here are the details of OS and software.
OS version
Windows 7 Enterprise Service pack 1 (32 bit)
Office version :
Microsoft Word 2013 (15.0.4701.1001) MSO (15.0.4701.1000) 32 Bit Part of Microsoft Office Professional Plus 2013
I hope this will help, but we had a similar problem with using the Excel COM libraries from one of our applications that was almost the same. We would open the Excel document and start typing into a cell, and a COM exception would be thrown. It was intermittent, until we noticed a pattern.
We narrowed it down to the fact that we were trying to load data into the cells from code, and that was still running while attempting to type into the cell. Basically, it is a race condition where whatever the COM api is doing is not complete and it conflicts with a user typing.
I imagine Word and the other Office applications have the same kind of problems. We have not fixed this yet, but we are going to look for a method of identifying if a cell is currently being edited, or prevent the user from making modifications until our code has completed loading data into cells.
Access violation exception mostly occurs if there is a Race Condition in your Code,Without seeing your code we don't know if there is any such problem.
If you are sure that your code doesn't have such conditions repairing the office installation will most likely solve the issue.
User contributions licensed under CC BY-SA 3.0