Unhandled Exceptions logger

Status
Niet open voor verdere reacties.

The Mighty Atom

Terugkerende gebruiker
Lid geworden
22 mei 2008
Berichten
1.380
Als hobbyprogrammeur is het altijd jammer om te horen dat je programma niet werkt of dat het fouten bevat wanneer je het laat testen door mede forum gebruikers. Denk bijvoorbeeld aan unhandled exceptions. Dit zijn fouten die niet worden afgevangen met een Try...Catch statement. Vaak zijn deze fouten makkelijk te fixen maar niet altijd, bijvoorbeeld als je exact moet weten WAAR de fout plaatsvond.

Om het voor ons hobbyprogrammeurs makkelijk te maken, heb ik deze bibliotheek geschreven die, zodra er een unhandled exception optreed, de foutgegevens netjes naar een bestand wegschrijft, en vervolgens een messagebox laten weergeven om de gebruiker te laten weten dat er zojuist een unhandled exception heeft plaatsgevonden.

De TheMightyAtom.UnhandledException class zal naast de foutmelding ook, indien beschikbaar, het bronbestand vermelden, de method naam en het regelnummer vermelden waarin de fout plaatsvond. Hier zitten wel een voorwaarde aan verbonden wil je deze gegeven verkrijgen. Hier kom ik later op terug.

De installatie instructies zijn als volgt (voor Visual Studio 2010 Professional met als programmeertaal VB.Net, andere edities van Visual Studio kunnen mogelijk verschillen):

1. Download the bibliotheek: LogUnhandledExceptionsLib Versie 1.0.0.0
2. In je Solution Explorer, dubbelklik op My Project.
3. Op het tabblad References, klik op Add....
4. Op het tabblad Browse zoek je de bibliotheek (dll) op die je hebt gedownload en open je deze. LogUnhandledExceptionsLib is nu toegevoegd aan de lijst met References.

Nu moet je er nog voor zorgen dat mijn bibliotheek eventuele unhandled exceptions in jouw programma kan afvangen. Dat doe je zo:

1. In je Solution Explorer, dubbelklik op My Project.
2. Op het tabblad [/i]Application, klik op de View Application Events knop.
3. Er word een nieuw bestand aan je project toegevoegd genaamd ApplicationEvents.vb/. Zet daar een UnhandledException sub klaar:

Code:
        Private Sub MyApplication_UnhandledException(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException

        End Sub

Voordat ik laat zien wat je verder moet doen in de MyApplication_UnhandledException sub, zal ik eerst alle beschikbare members beschrijven:

property.png
File (String)
WriteOnly Property
The file to write the unhandled exception details to.

property.png
ExceptionFeed (Exception)
WriteOnly Property
The exception feed to read and process.

property.png
ShowExceptionDetails (Boolean)
WriteOnly Property
If true, show a messagebox with all the exception details to the user. (Default value: True)

property.png
Message (String)
ReadOnly Property
Returns the message associated with the exception.

property.png
SourceFile (String)
ReadOnly Property
Returns the source filename in which the exception occured.

property.png
Method (String)
ReadOnly Property
Returns the method in which the exception occured.

property.png
LineNumber (String)
ReadOnly Property
Returns the line number on which the exception occured.

method.png
LogUnhandledException
Public Method
Writes the exception details to the file specified.

Hieronder een voorbeeld van het klaarzetten van de MyApplication_UnhandledException sub.

Code:
Private Sub MyApplication_UnhandledException(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException

            [COLOR="seagreen"]'Een instance van the TheMightyAtom.UnhandledException klas maken[/COLOR]
            [COLOR="blue"]Dim[/COLOR] ue [COLOR="blue"]As New[/COLOR] TheMightyAtom.[COLOR="teal"]UnhandledException[/COLOR]

            [COLOR="seagreen"]'Bestand om de foutgegevens van de exception naar toe te schrijven[/COLOR]
            ue.File = [COLOR="darkred"]"C:\errors.txt"[/COLOR]

            [COLOR="seagreen"]'Feed opgeven[/COLOR]
            ue.ExceptionFeed = e.Exception

            [COLOR="seagreen"]'Wel of geen Messagebox weergeven wanneer er een unhandled exception optreedt (Optioneel, standaard waarde True)[/COLOR]
            ue.ShowExceptionDetails = [COLOR="blue"]True[/COLOR]

            [COLOR="seagreen"]'Voorkomen dat de applicatie automatisch word afgsloten[/COLOR]
            e.ExitApplication = [COLOR="blue"]False[/COLOR]

            [COLOR="seagreen"]'Foutgegevens naar het eerder opgegeven bestand schrijven[/COLOR]
            ue.LogUnhandledException()

End Sub

Als je bovenstaande voorbeeld code gebruikt, zal, wanneer er een unhandled exception in je programma plaatsvind, er een bestand genaamt error.txt in je C: directory worden aangemaakt. Ter voorbeeld, de inhoud van dat bestand zal er zo uit kunnen zien:

####################################################################################################

WindowsApplication1 1.0.0.0 - Unhandled Exceptions Log

####################################################################################################

####################################################################################################
Message:
De conversie van tekenreeks one naar type Double is ongeldig.

Source file:
Form1.vb

Method:
Button1_Click

Line number:
8
####################################################################################################

Als er meerdere unhandled exception optreden, worden de details toegevoegd aan dit bestand.

Zoals ik al eerder zei, is er een voorwaarde verbonden als je het bronbestand, method naam en regelnummer wilt achterhalen, en dat is dat het Program Debug Database bestand aanwezig moet zijn naast je executable en dat je dit bestand, samen met je executable moet delen. Zonder dit bestand is alleen de message beschikbaar en zullen het bronbestand, method naam en regelnummer "(Unkown") aanduiden.

Ook is het zo dat, als je dit alles wilt testen, je je executable BUITEN Visual Studio moet starten. Als je dit binnen Visual Studio doet via Debug Run (F5) zul je een standaard Visual Studio messagebox zien met de unhandled exception.

Dat is alles wat je moeten weten.
Hopelijk heb je wat aan mijn bibliotheek en hopelijk zal het je leven als hobbyprogrammeur makkelijker maken als het op foutopsporing aankomt. :)
 
Laatst bewerkt:
Kom op mensen, zo ingewikkeld is het toch niet? Het zal vele van ons een hoop gezoek besparen wanneer je aan een groot project werkt.
 
Het ziet er allemaal wel goed uit enzo, maar waarom zou je dit gebruiken als de debugger van de IDE zelf kan gebruiken.
De debugger van de IDE geeft ook meer gegevens dan jouw lib..
Mijn UpdateLib heeft ook een ingebouwde error logger: (oude versie)

hoe er een fout log bij mij uitziet:
Code:
** ** **
** UpdateLib.dll - Error Report File
** **
** Version: 1.63.78.31
** Support: http://www.matthiware.net63.net/
** ** **



Application:        Test.UpdateLib
Version:            1.1.0.0
Date:               05/02/2012 16:56:27
Computer name:      MATTHIEE
User name:          AdminMatthi
OS:                 Microsoft Windows NT 6.1.7601 Service Pack 1
Culture:            nl-BE
Resolution:         {Width=1600, Height=900}
System up time:     06:52:12.8690000
App up time:        00:07:26.7495526

Exception classes:    
   System.NullReferenceException

Exception messages:  
   De objectverwijzing is niet op een exemplaar van een object ingesteld.

Stack Traces: 
   bij MatthiWare.UpdateDialog.Rewrite(DisplayLanguage Lang)
   bij MatthiWare.UpdateDialog.ShowUpdateDialog()

Loaded Modules: 
C:\Users\AdminMatthi\Documents\Visual Studio 2010\Projects\UpdateLib\Test.UpdateLib\bin\Debug\Test.UpdateLib.vshost.exe 10.0.30319.1
C:\Windows\SysWOW64\ntdll.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\SYSTEM32\MSCOREE.DLL 4.0.40305.0 (Main.040305-0000)
C:\Windows\syswow64\KERNEL32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\KERNELBASE.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\apphelp.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\AppPatch\AcLayers.DLL 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\SspiCli.dll 6.1.7601.17725 (win7sp1_gdr.111116-1503)
C:\Windows\syswow64\msvcrt.dll 7.0.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\RPCRT4.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\CRYPTBASE.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\SysWOW64\sechost.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\USER32.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\GDI32.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\LPK.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\USP10.dll 1.0626.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\ADVAPI32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\SHELL32.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\SHLWAPI.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\ole32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\OLEAUT32.dll 6.1.7601.17676
C:\Windows\system32\USERENV.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\profapi.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\WINSPOOL.DRV 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\MPR.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\IMM32.DLL 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\MSCTF.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll 2.0.50727.5448 (Win7SP1GDR.050727-5400)
C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_d09154e044272b9a\MSVCR80.dll 8.00.50727.6195
C:\Windows\assembly\NativeImages_v2.0.50727_32\mscorlib\a1a82db68b3badc7c27ea1f6579d22c5\mscorlib.ni.dll 2.0.50727.5448 (Win7SP1GDR.050727-5400)
C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorsec.dll 2.0.50727.4927 (NetFXspW7.050727-4900)
C:\Windows\syswow64\WINTRUST.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\CRYPT32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\MSASN1.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149af\COMCTL32.dll 5.82 (win7_rtm.090713-1255)
C:\Windows\system32\CRYPTSP.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rsaenh.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\imagehlp.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\ncrypt.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\bcrypt.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\SysWOW64\bcryptprimitives.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\GPAPI.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\cryptnet.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\WLDAP32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\SensApi.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\Cabinet.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\DEVRTL.dll 6.1.7601.17621 (win7sp1_gdr.110523-2108)
C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll 10.0.30319.1
C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll 2.0.50727.5446 (Win7SP1GDR.050727-5400)
C:\Windows\syswow64\CLBCatQ.DLL 2001.12.8530.16385 (win7_rtm.090713-1255)
C:\Windows\system32\RpcRtRemote.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System\abab08afa60a6f06bdde0fcc9649c379\System.ni.dll 2.0.50727.5447 (Win7SP1GDR.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Drawing\3b2cfd85528a27eb71dc41d8067359a1\System.Drawing.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Windows.Forms\6e592e424a204aafeadbe22b6b31b9db\System.Windows.Forms.ni.dll 2.0.50727.5446 (Win7SP1GDR.050727-5400)
C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll 10.0.30319.1
C:\Windows\system32\VERSION.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll 10.0.30319.1
C:\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\x86\Microsoft.VisualStudio.Debugger.Runtime.Impl.dll 10.0.30319.1 built by: RTMRel
C:\Windows\system32\MSVCR100.dll 10.00.40219.325
C:\Windows\assembly\GAC_MSIL\mscorlib.resources\2.0.0.0_nl_b77a5c561934e089\mscorlib.resources.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\system32\SXS.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\psapi.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Core\dd56ffc9d534de278c79420dcce058a4\System.Core.ni.dll 3.5.30729.5420 built by: Win7SP1
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Xml.Linq\88f32d62a8df469e8b9f12a8d3093627\System.Xml.Linq.ni.dll 3.5.30729.5420 built by: Win7SP1
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Data.DataSet#\c523aa7f545394a1ed7f9a6358cf18e3\System.Data.DataSetExtensions.ni.dll 3.5.30729.5420 built by: Win7SP1
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Data\f8196c3588c2229e84516af4b6a0ee60\System.Data.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\syswow64\WS2_32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\NSI.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Deployment\dd2070ee8e6e28ac8dc658404c50ebde\System.Deployment.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Xml\130ad4d9719e566ca933ac7158a04203\System.Xml.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\system32\uxtheme.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\dwmapi.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80\gdiplus.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\WindowsCodecs.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll 6.10 (win7_rtm.090713-1255)
C:\Windows\assembly\GAC_MSIL\System.Deployment.resources\2.0.0.0_nl_b03f5f7f11d50a3a\System.Deployment.resources.dll 2.0.50727.4927 (NetFXspW7.050727-4900)
C:\Windows\system32\shfolder.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\wininet.dll 9.00.8112.16421 (WIN7_IE9_RTM.110308-0330)
C:\Windows\syswow64\Normaliz.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\iertutil.dll 9.00.8112.16440 (WIN7_IE9_GDR.111103-1400)
C:\Windows\syswow64\urlmon.dll 9.00.8112.16421 (WIN7_IE9_RTM.110308-0330)
C:\Windows\system32\Secur32.dll 6.1.7601.17725 (win7sp1_gdr.111116-1503)
C:\Windows\system32\dnsapi.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\iphlpapi.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\WINNSI.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\RASAPI32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rasman.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rtutils.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Configuration\2d5bcbeb9475ef62189f605bcca1cec6\System.Configuration.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\system32\mswsock.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\System32\wshtcpip.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\System32\wship6.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\winhttp.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\webio.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\dhcpcsvc.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\dhcpcsvc6.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\credssp.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\CFGMGR32.dll 6.1.7601.17621 (win7sp1_gdr.110523-2108)
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL 7.250.4225.0
C:\Windows\system32\rasadhlp.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\System32\fwpuclnt.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\assembly\GAC_MSIL\System.resources\2.0.0.0_nl_b77a5c561934e089\System.resources.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll 8.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\system32\ntmarta.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\pcwum.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\perfcounter.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\system32\pdh.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\MSVCR110_CLR0400.dll 11.00.40805.17020
C:\Windows\system32\aspnet_counters.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_perf.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Program Files (x86)\Microsoft SQL Server\100\Shared\instapi10.dll 2007.0100.1600.022 ((SQL_PreRelease).080709-1414 )
C:\Windows\system32\tapi32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\System32\perfos.dll 6.1.7600.16385 (win7_rtm.090713-1255)

********************************************************************************



Application:        Test.UpdateLib
Version:            1.1.0.0
Date:               06/02/2012 22:28:04
Computer name:      MATTHIEE
User name:          AdminMatthi
OS:                 Microsoft Windows NT 6.1.7601 Service Pack 1
Culture:            nl-BE
Resolution:         {Width=1600, Height=900}
System up time:     05:07:39.2750000
App up time:        00:01:00.2564464

Exception classes:    
   System.NullReferenceException

Exception messages:  
   De objectverwijzing is niet op een exemplaar van een object ingesteld.

Stack Traces: 
   bij MatthiWare.UpdateDialog.Rewrite(DisplayLanguage Lang)
   bij MatthiWare.UpdateDialog.ShowUpdateDialog()

Loaded Modules: 
C:\Program Files (x86)\MatthiWare\Test\Test.UpdateLib.exe 1.1.0.0
C:\Windows\SysWOW64\ntdll.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\SYSTEM32\MSCOREE.DLL 4.0.40305.0 (Main.040305-0000)
C:\Windows\syswow64\KERNEL32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\KERNELBASE.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\ADVAPI32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\msvcrt.dll 7.0.7600.16385 (win7_rtm.090713-1255)
C:\Windows\SysWOW64\sechost.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\RPCRT4.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\SspiCli.dll 6.1.7601.17725 (win7sp1_gdr.111116-1503)
C:\Windows\syswow64\CRYPTBASE.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\syswow64\SHLWAPI.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\GDI32.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\USER32.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\LPK.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\USP10.dll 1.0626.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\IMM32.DLL 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\MSCTF.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll 2.0.50727.5448 (Win7SP1GDR.050727-5400)
C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_d09154e044272b9a\MSVCR80.dll 8.00.50727.6195
C:\Windows\syswow64\shell32.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\ole32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\profapi.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\assembly\NativeImages_v2.0.50727_32\mscorlib\a1a82db68b3badc7c27ea1f6579d22c5\mscorlib.ni.dll 2.0.50727.5448 (Win7SP1GDR.050727-5400)
C:\Windows\system32\uxtheme.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\assembly\GAC_MSIL\mscorlib.resources\2.0.0.0_nl_b77a5c561934e089\mscorlib.resources.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll 2.0.50727.5446 (Win7SP1GDR.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System\abab08afa60a6f06bdde0fcc9649c379\System.ni.dll 2.0.50727.5447 (Win7SP1GDR.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Drawing\3b2cfd85528a27eb71dc41d8067359a1\System.Drawing.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Windows.Forms\6e592e424a204aafeadbe22b6b31b9db\System.Windows.Forms.ni.dll 2.0.50727.5446 (Win7SP1GDR.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Configuration\2d5bcbeb9475ef62189f605bcca1cec6\System.Configuration.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Xml\130ad4d9719e566ca933ac7158a04203\System.Xml.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\system32\dwmapi.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\CRYPTSP.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rsaenh.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\RpcRtRemote.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Program Files (x86)\MatthiWare\Test\UpdateLib.dll 1.71.63.78
C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80\gdiplus.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\WindowsCodecs.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll 6.10 (win7_rtm.090713-1255)
C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Deployment\dd2070ee8e6e28ac8dc658404c50ebde\System.Deployment.ni.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\assembly\GAC_MSIL\System.Deployment.resources\2.0.0.0_nl_b03f5f7f11d50a3a\System.Deployment.resources.dll 2.0.50727.4927 (NetFXspW7.050727-4900)
C:\Windows\system32\shfolder.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\version.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\iphlpapi.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\NSI.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\WINNSI.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\DNSAPI.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\WS2_32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\dhcpcsvc.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\dhcpcsvc6.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\mswsock.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\System32\wshtcpip.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\System32\wship6.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rasapi32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rasman.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rtutils.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\winhttp.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\webio.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\system32\credssp.dll 6.1.7601.17514 (win7sp1_rtm.101119-1850)
C:\Windows\syswow64\CFGMGR32.dll 6.1.7601.17621 (win7sp1_gdr.110523-2108)
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL 7.250.4225.0
C:\Windows\syswow64\PSAPI.DLL 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\rasadhlp.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\System32\fwpuclnt.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll 8.0.50727.5420 (Win7SP1.050727-5400)
C:\Windows\system32\ntmarta.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\syswow64\WLDAP32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\pcwum.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\perfcounter.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\syswow64\OLEAUT32.dll 6.1.7601.17676
C:\Windows\system32\pdh.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\system32\MSVCR110_CLR0400.dll 11.00.40805.17020
C:\Windows\system32\aspnet_counters.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_perf.dll 4.0.30319.17020 built by: FXM3REL
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.dll 2.0.50727.5420 (Win7SP1.050727-5400)
C:\Program Files (x86)\Microsoft SQL Server\100\Shared\instapi10.dll 2007.0100.1600.022 ((SQL_PreRelease).080709-1414 )
C:\Windows\system32\tapi32.dll 6.1.7600.16385 (win7_rtm.090713-1255)
C:\Windows\System32\perfos.dll 6.1.7600.16385 (win7_rtm.090713-1255)

********************************************************************************
Bekijk bijlage Updater_Error_Log.log.txt

Maar voor de rest kan je er niet veel fout in gedaan hebben. Je gebruikt al de ingebouwde evenement om uitzonderingen te loggen en dan gewoon doorsturen naar je lib en deze maakt een log bestandje.

Maar buiten dat, goed werk!
 
Dit is vooral bedoeld mensen die je programma testen. Als die een fout ontdekken die je zelf over het hoofd hebt gezien, kan de gegeven informatie je helpen de locatie van de fout bepalen.

Ik zal mijn library updaten en ervoor zorgen dat deze meer informatie geeft zoals OS, Resolution, uptime en dat soort dingen, als je het goed vind.
 
Ah okee maar dan nog ze hebben het program debug bestand niet dus kan jij ook nooit weten op welke lijn enzo..

Het maakt niet zoveel uit of ik het goed vind :p (tenzij je naar me opkijkt wat ik sterk betwijfel).. :p maar ja dat is goed voor mij.

Nu ik er zo over nadenk kan je ook een plug in systeem maken die kijkt of de dll er is als die er is laad hij hem en alleen dan maakt hij de log. Is goed voor als je mensen hebt bij wie iets fout is. Ze gewoon de DLL laaten downloaden en in de applicatie folder zetten en voila error log is gemaakt en moet gewoon nog opgestuurd worden naar de developers :) maar dat is maar gewoon een ideetje (offtopic) :p
 
Dat program debug bestand stuur ik mee natuurlijk.
Ik zal zien wat ik kan doen.

Misschien kun je me vertellen hoe ik de exception class verkrijg? Ik heb daar al eens eerder naar gekeken en kwam er toen niet uit.

En hoe kom je aan alle geladen modules?
 
Voor de class type te krijgen gebruikte ik dit:
Code:
private string GetExceptionTypeStack(Exception e)
            {
                if (e.InnerException != null)
                {
                    StringBuilder message = new StringBuilder();
                    message.AppendLine(GetExceptionTypeStack(e.InnerException));
                    message.AppendLine("   " + e.GetType().ToString());
                    return (message.ToString());
                }
                else
                {
                    return "   " + e.GetType().ToString();
                }
            }

En voor de geladen modules:
Code:
Process thisProcess = Process.GetCurrentProcess();
                foreach (ProcessModule module in thisProcess.Modules)
                {
                    try
                    {
                        error.AppendLine(module.FileName + " " + module.FileVersionInfo.FileVersion);
                    }
                    catch (Exception) { //Sommige modules kan je niet openen daarmee deze try catch..}
                }
 
Thanks. :)
Je vind het toch niet erg dat ik mijn exceptionlogger een beetje op de jouwe laat lijken, met name de output log file?
 
app uptime is gewoon
Code:
(DateTime.Now - Process.GetCurrentProcess().StartTime).ToString());

Maar system uptime is ietsjes moeilijker.
Code:
private static TimeSpan GetSystemUpTime()
            {
                PerformanceCounter upTime = new PerformanceCounter("System", "System Up Time");
                upTime.NextValue();
                return TimeSpan.FromSeconds(upTime.NextValue());
            }
 
Hmmm ik heb daar nog wat problemen mee.
Ik werk met VB.Net en ik krijg meldingen dat hij timespan niet kan converteren naar string.
 
dit is mijn vb vertaling ervan: (zelf gedaan)
Code:
private Function GetSystemUpTime() as TimeSpan 
            
                Dim upTime as PerformanceCounter = new PerformanceCounter("System", "System Up Time")
                upTime.NextValue()
                return TimeSpan.FromSeconds(upTime.NextValue())
            End Function

en normaal zou
Code:
GetSystemUpTime().ToString()
moeten werken
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan