T0biasCZe / Windows-Media-Player-Discord-RPC

Discord rich presence for windows media player
Mozilla Public License 2.0
11 stars 0 forks source link

Unhandled exception error + wont detect WMP when run as administrator #5

Open Hrobo776 opened 8 months ago

Hrobo776 commented 8 months ago

Whenever I run the exe file, it detects the WMP and the song/music its playing, however, it throws an unhandled exception error right after it loads up. image

I decided to run the exe as administrator hoping it would work, it loads just fine, however, it doesnt detect WMP and just says "Stopped". Console reads: "error trying to read WMP data, retrying", followed by another line saying "aborting", repeating every second image

T0biasCZe commented 8 months ago

What does it show in the details inside the unhandled exception error?

T0biasCZe commented 8 months ago

And it doesn't work when run as admin, since when running as admin it can't read the data from WMP that's running as user

Hrobo776 commented 8 months ago

This is what it says exactly

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** System.NullReferenceException: Object reference not set to an instance of an object. at Discord_WMP.Form1.update_Tick(Object sender, EventArgs e) in C:\Users\tobik\Source\Repos\T0biasCZe\Windows-Media-Player-Discord-RPC\Discord WMP\Form1.cs:line 301 at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

** Loaded Assemblies ** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.8.9181.0 built by: NET481REL1LAST_C CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

Discord WMP Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///E:/DRP4WMP/Discord%20WMP.exe

System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.8.9181.0 built by: NET481REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System Assembly Version: 4.0.0.0 Win32 Version: 4.8.9206.0 built by: NET481REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.8.9037.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.8.9037.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.8.9200.0 built by: NET481REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.8.9037.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

Accessibility Assembly Version: 4.0.0.0 Win32 Version: 4.8.9037.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

Interop.WMPLib Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///E:/DRP4WMP/Interop.WMPLib.DLL

CsvHelper Assembly Version: 30.0.0.0 Win32 Version: 30.0.1.0 CodeBase: file:///E:/DRP4WMP/CsvHelper.DLL

Microsoft.Bcl.AsyncInterfaces Assembly Version: 1.0.0.0 Win32 Version: 4.700.19.46214 CodeBase: file:///E:/DRP4WMP/Microsoft.Bcl.AsyncInterfaces.DLL

System.Numerics Assembly Version: 4.0.0.0 Win32 Version: 4.8.9037.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll

Microsoft.Bcl.HashCode Assembly Version: 1.0.0.0 Win32 Version: 4.700.19.46214 CodeBase: file:///E:/DRP4WMP/Microsoft.Bcl.HashCode.DLL

Anonymously Hosted DynamicMethods Assembly Assembly Version: 0.0.0.0 Win32 Version: 4.8.9181.0 built by: NET481REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll

DiscordRPC Assembly Version: 1.2.1.24 Win32 Version: 1.2.1.24 CodeBase: file:///E:/DRP4WMP/DiscordRPC.DLL

** JIT Debugging ** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.

For example:

When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.

Hrobo776 commented 8 months ago

I updated the program but it still wouldnt open, still throwing the same Unhandled exception error as seen in the first image

T0biasCZe commented 8 months ago

hmm do you have discord installed and running? since in the error it mentions line 301, on which the discord rich presence is being set. and it may throw error
(if you do not want to use discord there is checkbox in settings to disable the discord functionality)

keroblin commented 7 months ago

Also having this error, runs fine with Discord and Windows Media Player closed, but then immediately throws errors when Discord is opened

keroblin commented 7 months ago

this is my error message

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** System.NullReferenceException: Object reference not set to an instance of an object. at Discord_WMP.Form1.update_Tick(Object sender, EventArgs e) in C:\Users\tobik\Source\Repos\T0biasCZe\Windows-Media-Player-Discord-RPC\Discord WMP\Form1.cs:line 307 at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

** Loaded Assemblies ** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.8.9181.0 built by: NET481REL1LAST_C CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

Discord WMP Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///D:/Programs/Discord%20WMP/Discord%20WMP.exe

System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.8.9181.0 built by: NET481REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System Assembly Version: 4.0.0.0 Win32 Version: 4.8.9214.0 built by: NET481REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.8.9214.0 built by: NET481REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

Interop.WMPLib Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///D:/Programs/Discord%20WMP/Interop.WMPLib.DLL

Accessibility Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

CsvHelper Assembly Version: 30.0.0.0 Win32 Version: 30.0.1.0 CodeBase: file:///D:/Programs/Discord%20WMP/CsvHelper.DLL

Microsoft.Bcl.AsyncInterfaces Assembly Version: 1.0.0.0 Win32 Version: 4.700.19.46214 CodeBase: file:///D:/Programs/Discord%20WMP/Microsoft.Bcl.AsyncInterfaces.DLL

System.Numerics Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll

Microsoft.Bcl.HashCode Assembly Version: 1.0.0.0 Win32 Version: 4.700.19.46214 CodeBase: file:///D:/Programs/Discord%20WMP/Microsoft.Bcl.HashCode.DLL

Anonymously Hosted DynamicMethods Assembly Assembly Version: 0.0.0.0 Win32 Version: 4.8.9181.0 built by: NET481REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll

DiscordRPC Assembly Version: 1.2.1.24 Win32 Version: 1.2.1.24 CodeBase: file:///D:/Programs/Discord%20WMP/DiscordRPC.DLL

Windows.Media Assembly Version: 255.255.255.255 Win32 Version: 10.0.10011.16384 CodeBase: file:///C:/WINDOWS/SysNative/WinMetadata/Windows.Media.winmd

System.Runtime Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll

Windows.Foundation Assembly Version: 255.255.255.255 Win32 Version: 10.0.10011.16384 CodeBase: file:///C:/WINDOWS/SysNative/WinMetadata/Windows.Foundation.winmd

System.Runtime.InteropServices.WindowsRuntime Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.InteropServices.WindowsRuntime/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.InteropServices.WindowsRuntime.dll

System.Runtime.WindowsRuntime Assembly Version: 4.0.0.0 Win32 Version: 4.8.9032.0 built by: NET481REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.WindowsRuntime/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.WindowsRuntime.dll

Windows.Storage Assembly Version: 255.255.255.255 Win32 Version: 10.0.10011.16384 CodeBase: file:///C:/WINDOWS/SysNative/WinMetadata/Windows.Storage.winmd

** JIT Debugging ** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.

For example:

When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.

T0biasCZe commented 7 months ago

please try this build if it works or if it still throws error [old file deleted]

keroblin commented 7 months ago

image unfortunately this now doesn't ask me about Discord at all and shows these windows. It does not sync with discord either, but there are no errors thrown

T0biasCZe commented 7 months ago

I apologize, I accidentally uploaded old zip, this is the file with the potential fix implemented: Discord WMP.zip

keroblin commented 7 months ago

Hi again and thanks for all your help, Unfortunately, while not crashing and now displaying the data correctly in the window, it is not showing in Discord still at this stage. Is there anything more I need to do?

keroblin commented 7 months ago

Also when I click the taskbar tray icon to open the window and view the data, it will work for a couple of seconds before crashing and closing, unfortunately without an error report crash discord wmp

T0biasCZe commented 7 months ago

try inserting "1076519967631093891" into the empty textbox at the top (without the quotes)

keroblin commented 7 months ago

Unfortunately this doesn't do anything When I click the settings button the app still crashes after a few seconds and it doesn't link to my Discord

keroblin commented 7 months ago

crash discord wmp 2

T0biasCZe commented 7 months ago

When you restart it does the ID you entered get saved or not (it should) Because what worries me is that in the debug values, it shows "Initialized: False", so the Discord RPC doesn't want to get started for some reason even though it's enablrd

Dne po 22. 1. 2024 14:46 uživatel Casper @.***> napsal:

crash.discord.wmp.2.gif (view on web) https://github.com/T0biasCZe/Windows-Media-Player-Discord-RPC/assets/56348046/2bee9fce-3fd1-41df-aaac-47484f3fbe09

— Reply to this email directly, view it on GitHub https://github.com/T0biasCZe/Windows-Media-Player-Discord-RPC/issues/5#issuecomment-1904038618, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTWPBQMM3FWQ2RDOMDASULYPZUUVAVCNFSM6AAAAABAYINF5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBUGAZTQNRRHA . You are receiving this because you commented.Message ID: @.*** com>