Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisplaName items caused crash - EventLogNotFoundException/Cannot find file #1

Open
BeanBagKing opened this issue Jan 28, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@BeanBagKing
Copy link
Owner

I found that at least one event in particular, an Office 2016 Licensing Service event with a level of Error in the Application Log would crash EventFinder. Reading this log would crash things with an EventLogNotFoundException reading "The system cannot find the file specified". I have no idea why this is the exception thrown.

This only appeared to crash when setting LevelDisplayName, OpcodeDisplayName, and TaskDisplayName. This doesn't seem to be due to null values. First, the error is wrong. I also tried checking for nulls via if statements (string != null) and String.IsNullOrEmpty().

I solved this by adding several try/catch statements for these variables that seem to do nothing, but it works now.

The attached zip file contains the CSV output after the try/catch statements were put in place. Line 5 contains the offending log line (note that there is no message! Spooky!). It also contains the log itself.

Below is the exception.

-   $exception  {"The system cannot find the file specified"} System.Diagnostics.Eventing.Reader.EventLogNotFoundException


System.Diagnostics.Eventing.Reader.EventLogNotFoundException
  HResult=0x80131500
  Source=System.Core
  StackTrace:
   at System.Diagnostics.Eventing.Reader.EventLogException.Throw(Int32 errorCode)
   at System.Diagnostics.Eventing.Reader.NativeWrapper.EvtOpenProviderMetadata(EventLogHandle session, String ProviderId, String logFilePath, Int32 locale, Int32 flags)
   at System.Diagnostics.Eventing.Reader.ProviderMetadata..ctor(String providerName, EventLogSession session, CultureInfo targetCultureInfo, String logFilePath)
   at System.Diagnostics.Eventing.Reader.ProviderMetadataCachedInformation.GetProviderMetadata(ProviderMetadataId key)
   at System.Diagnostics.Eventing.Reader.ProviderMetadataCachedInformation.GetLevelDisplayName(String ProviderName, EventLogHandle eventHandle)
   at System.Diagnostics.Eventing.Reader.EventLogRecord.get_LevelDisplayName()
   at EventFinder.FindEvents.FindEventsButton_Click(Object sender, EventArgs e) in C:\Users\BBK\source\repos\EventFinder2\EventFinder\Form1.cs:line 130
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at EventFinder.Program.Main() in C:\Users\BBK\source\repos\EventFinder2\EventFinder\Program.cs:line 19

CrashEvent.zip

@BeanBagKing BeanBagKing added the bug Something isn't working label Jan 28, 2019
BeanBagKing pushed a commit that referenced this issue Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant