Programm beendet sich selber mit Fehlercode

  • C#

Es gibt 5 Antworten in diesem Thema. Der letzte Beitrag () ist von RodFromGermany.

    Programm beendet sich selber mit Fehlercode

    Hallo,
    ich habe einen Fehler in meinem Programm der sporadisch auftritt. Wenn ich einen SaveFileDialog schließe kann es passieren das sich das Programm beendet. Wenn das Problem auftritt wird keine Ausnahme ausgelöst und somit bekomme ich auch keine Fehlermeldung. Deshalb habe ich mir die Windows Ereignisanzeige zur Hilfe genommen. Anscheinend tritt die Ausnahme in der DUI70.dll auf ("Windows DirectUI Engine"). Nach Google soll das neu installieren von Windows helfen, weil mir das allerdings Zuviel Arbeit ist habe ich das Programm in einer VM, mit einer neuen Windows 10 Installation, laufen gelassen. Und auch hier tritt der Fehler auf. Was mich wundert ist das die Ausnahme durch alle try-catch Blöcke geht ohne das sie irgendwo gefangen wird.

    Ich bin für jede Hilfe dankbar um diesen Fehler zu beheben.

    Viele Grüße

    Der Code wo das Problem auftritt: (Die Anweisung im if-Block wird nicht mehr ausgeführt)

    C#-Quellcode

    1. private void tsbExcel_Click(object sender, EventArgs e)
    2. {
    3. try
    4. {
    5. using (SaveFileDialog saveDialog = new SaveFileDialog()
    6. {
    7. ValidateNames = true,
    8. CheckPathExists = true,
    9. CheckFileExists = false,
    10. Title = "Speicherort wählen",
    11. SupportMultiDottedExtensions = true,
    12. AddExtension = true,
    13. Filter = "Microsoft Excel (*.xlsx)|*.xlsx"
    14. })
    15. {
    16. if (saveDialog.ShowDialog() == DialogResult.OK)
    17. {
    18. new ExcelWriter(dgvRecords).Generate(saveDialog.FileName);
    19. }
    20. }
    21. }
    22. catch (Exception ex)
    23. {
    24. LogWriter.WriteError(ex, true);
    25. }
    26. }


    Windows Ereignisanzeige Fehlermeldung 1:

    Quellcode

    1. ​Name der fehlerhaften Anwendung: DGV.exe, Version: 1.0.6938.41736, Zeitstempel: 0x5c294281
    2. Name des fehlerhaften Moduls: DUI70.dll, Version: 10.0.17134.112, Zeitstempel: 0x5741755e
    3. Ausnahmecode: 0xc000041d
    4. Fehleroffset: 0x00059e5f
    5. ID des fehlerhaften Prozesses: 0x497c
    6. Startzeit der fehlerhaften Anwendung: 0x01d4a08c943eca75
    7. Pfad der fehlerhaften Anwendung: C:\repos\DGV\DGV\DGV\bin\Debug\DGV.exe
    8. Pfad des fehlerhaften Moduls: C:\Windows\system32\DUI70.dll
    9. Berichtskennung: f72a1d59-766c-4cab-bd91-4e7a2f29cc6a
    10. Vollständiger Name des fehlerhaften Pakets:
    11. Anwendungs-ID, die relativ zum fehlerhaften Paket ist:


    Windows Ereignisanzeige Fehlermeldung 2:

    Quellcode

    1. ​Anwendung: DGV.exe
    2. Frameworkversion: v4.0.30319
    3. Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
    4. Ausnahmeinformationen: Ausnahmecode c0000005, Ausnahmeadresse 652E9E5F
    5. Stapel:
    6. bei System.Windows.Forms.FileDialogNative+IFileDialog.Show(IntPtr)
    7. bei System.Windows.Forms.FileDialog.RunDialogVista(IntPtr)
    8. bei System.Windows.Forms.FileDialog.RunDialog(IntPtr)
    9. bei System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)
    10. bei System.Windows.Forms.CommonDialog.ShowDialog()
    11. bei DGV.Forms.Select.tsbExcel_Click(System.Object, System.EventArgs)
    12. bei System.Windows.Forms.ToolStripItem.RaiseEvent(System.Object, System.EventArgs)
    13. bei System.Windows.Forms.ToolStripButton.OnClick(System.EventArgs)
    14. bei System.Windows.Forms.ToolStripItem.HandleClick(System.EventArgs)
    15. bei System.Windows.Forms.ToolStripItem.HandleMouseUp(System.Windows.Forms.MouseEventArgs)
    16. bei System.Windows.Forms.ToolStripItem.FireEventInteractive(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)
    17. bei System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)
    18. bei System.Windows.Forms.ToolStrip.OnMouseUp(System.Windows.Forms.MouseEventArgs)
    19. bei System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)
    20. bei System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
    21. bei System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)
    22. bei System.Windows.Forms.ToolStrip.WndProc(System.Windows.Forms.Message ByRef)
    23. bei System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
    24. bei System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
    25. bei System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
    26. bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
    27. bei System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
    28. bei System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
    29. bei System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
    30. bei System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)
    31. bei System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
    32. bei System.Windows.Forms.Form.ShowDialog()
    33. bei DGV.Class.Table.LookUp.Show(DGV.Class.Struct.Adapter, System.Object[])
    34. bei DGV.Forms.Database.Materials.tsbSelect_Click(System.Object, System.EventArgs)
    35. bei System.Windows.Forms.ToolStripItem.RaiseEvent(System.Object, System.EventArgs)
    36. bei System.Windows.Forms.ToolStripButton.OnClick(System.EventArgs)
    37. bei System.Windows.Forms.ToolStripItem.HandleClick(System.EventArgs)
    38. bei System.Windows.Forms.ToolStripItem.HandleMouseUp(System.Windows.Forms.MouseEventArgs)
    39. bei System.Windows.Forms.ToolStripItem.FireEventInteractive(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)
    40. bei System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)
    41. bei System.Windows.Forms.ToolStrip.OnMouseUp(System.Windows.Forms.MouseEventArgs)
    42. bei System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)
    43. bei System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
    44. bei System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)
    45. bei System.Windows.Forms.ToolStrip.WndProc(System.Windows.Forms.Message ByRef)
    46. bei System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
    47. bei System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
    48. bei System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
    49. bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
    50. bei System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
    51. bei System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
    52. bei System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
    53. bei System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)
    54. bei System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
    55. bei System.Windows.Forms.Form.ShowDialog()
    56. bei DGV.Forms.Startup.Startup_Load(System.Object, System.EventArgs)
    57. bei System.Windows.Forms.Form.OnLoad(System.EventArgs)
    58. bei System.Windows.Forms.Form.OnCreateControl()
    59. bei System.Windows.Forms.Control.CreateControl(Boolean)
    60. bei System.Windows.Forms.Control.CreateControl()
    61. bei System.Windows.Forms.Control.WmShowWindow(System.Windows.Forms.Message ByRef)
    62. bei System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
    63. bei System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)
    64. bei System.Windows.Forms.ContainerControl.WndProc(System.Windows.Forms.Message ByRef)
    65. bei System.Windows.Forms.Form.WmShowWindow(System.Windows.Forms.Message ByRef)
    66. bei System.Windows.Forms.Form.WndProc(System.Windows.Forms.Message ByRef)
    67. bei System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
    68. bei System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
    69. bei System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
    70. bei System.Windows.Forms.SafeNativeMethods.ShowWindow(System.Runtime.InteropServices.HandleRef, Int32)
    71. bei System.Windows.Forms.Control.SetVisibleCore(Boolean)
    72. bei System.Windows.Forms.Form.SetVisibleCore(Boolean)
    73. bei System.Windows.Forms.Control.set_Visible(Boolean)
    74. bei System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
    75. bei System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
    76. bei System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
    77. bei DGV.Program.Main()
    Willkommen im Forum. :thumbup:

    DLB schrieb:

    Wenn ich einen SaveFileDialog schließe
    bedeutet was?
    OK oder Abbruch?
    Was ist ExcelWriter?
    Was ist LogWriter?
    Was für weitere DLLs hast Du eingebunden?
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!
    *unnötiges Vollzitat entfernt*

    Bei einem Abbruch. ExcelWriter erstellt eine Excel Datei auf Basis eines DataGridViews und der LogWriter schreibt Ausnahmen in eine Logdatei.

    Eingebundene DLL's (Projekt):
    Microsoft.CSharp.dll
    System.dll
    System.ComponentModel.DataAnnotations.dll
    System.Core.dll
    System.Data.dll
    System.Data.DataSetExtensions.dll
    System.Deployment.dll
    System.Drawing.dll
    System.IO.FileSystem.Primitves.dll (über NuGet/Office Open XML SDK)
    System.IO.FileSystem.Packaging.dll (über NuGet/Office Open XML SDK)
    System.Net.Http.dll
    System.Runtime.Serialization.dll
    System.ValueTuple.dll (über NuGet/ValueTuple)
    System.Windows.Forms.dll
    System.Xml.dll
    System.Xml.Linq.dll
    WindowsBase.dll
    DocumentFormat.OpenXml.dll (über NuGet/Office Open XML SDK)
    Microsoft.ReportViewer.Common.dll (über NuGet/Microsoft ReportViewer)
    Microsoft.ReportViewer.DataVisualization.dll (über NuGet/Microsoft ReportViewer)
    Microsoft.ReportViewer.Design.dll (über NuGet/Microsoft ReportViewer)
    Microsoft.ReportViewer.ProcessingObjectModel.dll (über NuGet/Microsoft ReportViewer)
    Microsoft.ReportViewer.WinForms.dll (über NuGet/Microsoft ReportViewer)
    Microsoft.SqlServer.Types.dll (über NuGet/Microsoft ReportViewer)

    Verwendete Verweise in der Datei:

    C#-Quellcode

    1. using System;
    2. using System.Collections.Generic;
    3. using System.Data;
    4. using System.Windows.Forms;

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Marcus Gräfe“ ()

    DLB schrieb:

    Bei einem Abbruch.
    wird der ExcelWriter umgangen.
    Und:
    Unterlass das vollständige Zitieren ganzer Posts über Deinen.
    Welches Betriebssystem, welches Framework verwendest Du?
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!
    @DLB Hab ich auch so, ich kann es leider nicht reproduzieren. :/
    Sorry.
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!