jarrettgilliam / AutoGame

Automatically start your favorite game launcher at just the right moment.
MIT License
34 stars 2 forks source link

exception when clicking apply or ok #14

Closed gumaerc closed 1 year ago

gumaerc commented 2 years ago

AutoGame_2022-11-02_09-50-25

OS: Windows 10 21H1 19043.2006

Log output:

11/2/2022 9:48:53 AM -04:00 Error: handling Apply: System.Runtime.InteropServices.COMException (0x88890008): 0x88890008
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at NAudio.CoreAudioApi.AudioSessionManager.RefreshSessions()
   at NAudio.CoreAudioApi.AudioSessionManager..ctor(IAudioSessionManager audioSessionManager)
   at NAudio.CoreAudioApi.MMDevice.GetAudioSessionManager()
   at NAudio.CoreAudioApi.MMDevice.get_AudioSessionManager()
   at AutoGame.Infrastructure.Services.MMDeviceEnumeratorWrapper.MMDeviceWrapper.get_AudioSessionManager()
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.RegisterMMDeviceEvents(IMMDevice mmd, IList`1 parsecProcs)
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.RegisterAudioEvents()
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.StartMonitoring()
   at AutoGame.Core.Services.AutoGameService.ApplyConfiguration(Config config)
   at AutoGame.ViewModels.MainWindowViewModel.OnApply() in D:\a\AutoGame\AutoGame\src\AutoGame\ViewModels\MainWindowViewModel.cs:line 235
11/2/2022 9:49:07 AM -04:00 Error: handling Apply: System.Runtime.InteropServices.COMException (0x88890008): 0x88890008
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at NAudio.CoreAudioApi.AudioSessionManager.RefreshSessions()
   at NAudio.CoreAudioApi.AudioSessionManager..ctor(IAudioSessionManager audioSessionManager)
   at NAudio.CoreAudioApi.MMDevice.GetAudioSessionManager()
   at NAudio.CoreAudioApi.MMDevice.get_AudioSessionManager()
   at AutoGame.Infrastructure.Services.MMDeviceEnumeratorWrapper.MMDeviceWrapper.get_AudioSessionManager()
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.UnRegisterMMDeviceEvents(IMMDevice mmd, IList`1 parsecProcs)
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.UnRegisterAudioEvents()
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.StopMonitoring()
   at AutoGame.Core.Services.AutoGameService.StopMonitoringAllLaunchConditions()
   at AutoGame.Core.Services.AutoGameService.ApplyConfiguration(Config config)
   at AutoGame.ViewModels.MainWindowViewModel.OnApply() in D:\a\AutoGame\AutoGame\src\AutoGame\ViewModels\MainWindowViewModel.cs:line 235
11/2/2022 9:49:09 AM -04:00 Error: handling Apply: System.Runtime.InteropServices.COMException (0x80070490): Element not found. (0x80070490)
   at NAudio.CoreAudioApi.Interfaces.IMMDeviceEnumerator.UnregisterEndpointNotificationCallback(IMMNotificationClient client)
   at NAudio.CoreAudioApi.MMDeviceEnumerator.UnregisterEndpointNotificationCallback(IMMNotificationClient client)
   at AutoGame.Infrastructure.Services.MMDeviceEnumeratorWrapper.UnregisterEndpointNotificationCallback(IMMNotificationClient client)
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.UnRegisterAudioEvents()
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.StopMonitoring()
   at AutoGame.Core.Services.AutoGameService.StopMonitoringAllLaunchConditions()
   at AutoGame.Core.Services.AutoGameService.ApplyConfiguration(Config config)
   at AutoGame.ViewModels.MainWindowViewModel.OnApply() in D:\a\AutoGame\AutoGame\src\AutoGame\ViewModels\MainWindowViewModel.cs:line 235
11/2/2022 9:54:47 AM -04:00 Error: handling Apply: System.Runtime.InteropServices.COMException (0x80070490): Element not found. (0x80070490)
   at NAudio.CoreAudioApi.Interfaces.IMMDeviceEnumerator.UnregisterEndpointNotificationCallback(IMMNotificationClient client)
   at NAudio.CoreAudioApi.MMDeviceEnumerator.UnregisterEndpointNotificationCallback(IMMNotificationClient client)
   at AutoGame.Infrastructure.Services.MMDeviceEnumeratorWrapper.UnregisterEndpointNotificationCallback(IMMNotificationClient client)
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.UnRegisterAudioEvents()
   at AutoGame.Infrastructure.LaunchConditions.ParsecConnectedCondition.StopMonitoring()
   at AutoGame.Core.Services.AutoGameService.StopMonitoringAllLaunchConditions()
   at AutoGame.Core.Services.AutoGameService.ApplyConfiguration(Config config)
   at AutoGame.ViewModels.MainWindowViewModel.OnApply() in D:\a\AutoGame\AutoGame\src\AutoGame\ViewModels\MainWindowViewModel.cs:line 235

It looks like it's crashing when scanning audio devices or something? I have a ton of connected audio devices:

jarrettgilliam commented 2 years ago

Thanks for the detailed bug report. At the moment the application uses audio events and state to help determine when a Parsec session starts. A few months back I was working on a version that didn't use audio at all. I was planning on finishing that version eventually anyway. No time like the present.

morganrone93 commented 1 year ago

I also have this issue, any potential workaround we can do ourselves in the meantime? :)

jarrettgilliam commented 1 year ago

Nothing I can think of beyond unplugging/disabling the device it's having trouble with.

jarrettgilliam commented 1 year ago

Obviously that's not a great solution. I should have an updated version available for download in a month or so.

If you feel like compiling the current code branch yourself, the preview_3_0 branch has the most up to date version. Everything seems to be working now, but no promises I won't break something between now and release 😅.

If you don't have it, you can download Visual Studio Community for free. You'll also need the Microsoft Visual Studio Installer Projects 2022 extension if you want to build the installer.

jarrettgilliam commented 1 year ago

Fixed in version 3.0.0.