iXab3r / MicSwitch

MicSwitch is a tool which allows you to mute/unmute your microphone using a predefined hotkey
319 stars 29 forks source link

Frequent crashes since some weeks (Reopen of #102) #103

Open nametobechosen opened 1 year ago

nametobechosen commented 1 year ago

Because I don't know how to reopen #102 , I create this one as followup. 1.0.252 crashed as well. image

iXab3r commented 1 year ago

could you please check 253

nametobechosen commented 1 year ago

With 253 I had no crash "on its own", but some cases where mute did not work (hotkey, main window, icon). When I changed the microphone in the main window, it crashed: `Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used. at IntPtr System.StubHelpers.StubHelpers.GetCOMIPFromRCW(object objSrc, IntPtr pCPCMD, out IntPtr ppTarget, out bool pfNeedsRelease) at int NAudio.CoreAudioApi.Interfaces.IAudioEndpointVolume.GetMasterVolumeLevelScalar(out float pfLevel) at float? MicSwitch.Services.MultimediaDeviceController.getVolume() in C:/BuildAgent/work/61454f6050c7a045/Sources/MicSwitch/Services/MultimediaDeviceController.cs:line 85 at MicSwitch.MainWindow.ViewModels.MicrophoneControllerViewModel(IMMCaptureDeviceProvider deviceProvider, IFactory<IMMDeviceControllerEx, IMMDeviceProvider> deviceControllerFactory, IComplexHotkeyTracker hotkeyTracker, IFactory hotkeyTrackerFactory, IFactory hotkeyEditorFactory, IConfigProvider configProvider, IConfigProvider hotkeyConfigProvider, IScheduler uiScheduler)+((IMMDeviceController Previous, IMMDeviceController Current) x) => { } [50] in C:/BuildAgent/work/61454f6050c7a045/Sources/MicSwitch/MainWindow/ViewModels/MicrophoneControllerViewModel.cs:line 210 at void System.Reactive.AnonymousSafeObserver.OnNext(T value) in //Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:line 54 at void System.Reactive.Linq.ObservableImpl.Scan<TSource, TAccumulate>+.OnNext(TSource value) in //Rx.NET/Source/src/System.Reactive/Linq/Observable/Scan.cs:line 49 at void System.Reactive.Linq.ObservableImpl.Switch++InnerObserver.OnNext(TSource value) in //Rx.NET/Source/src/System.Reactive/Linq/Observable/Switch.cs:line 104 at void System.Reactive.Subjects.Subject.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 145 --- End of inner exception stack trace --- at object RuntimeMethodHandle.InvokeMethod(object target, in Span arguments, Signature sig, bool constructor, bool wrapExceptions) at object System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) at object Delegate.DynamicInvokeImpl(object[] args) at void PoeShared.Scaffolding.ConcurrentNpcEventInvoker.Raise(string propertyName) in C:/BuildAgent/work/61454f6050c7a045/Sources/PoeShared/Scaffolding/ConcurrentNpcEventInvoker.cs:line 111 at void MicSwitch.Services.ComplexMMDeviceController.set_ActiveController(IMMDeviceController value) in C:/BuildAgent/work/61454f6050c7a045/Sources/MicSwitch/Services/ComplexMMDeviceController.cs:line 92 at MicSwitch.Services.ComplexMMDeviceController(IFactory<MultimediaDeviceController, IMMDeviceProvider> multimediaControllerFactory, IFactory<CollectionMMDevicesController, IReadOnlyObservableCollection> collectionControllerFactory, IMMDeviceProvider deviceProvider)+((IMMDeviceController Previous, IMMDeviceController Current) x) => { } [2] in C:/BuildAgent/work/61454f6050c7a045/Sources/MicSwitch/Services/ComplexMMDeviceController.cs:line 53 at IDisposable PoeShared.Scaffolding.ObservableExtensions.SubscribeSafe(IObservable source, Action onNext, Action onError)+(T x) => { } in C:/BuildAgent/work/61454f6050c7a045/Sources/PoeShared/Scaffolding/ObservableExtensions.cs:line 71

Message:

Exception has been thrown by the target of an invocation.StackTrace:

at object RuntimeMethodHandle.InvokeMethod(object target, in Span arguments, Signature sig, bool constructor, bool wrapExceptions) at object System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) at object Delegate.DynamicInvokeImpl(object[] args) at void PoeShared.Scaffolding.ConcurrentNpcEventInvoker.Raise(string propertyName) in C:/BuildAgent/work/61454f6050c7a045/Sources/PoeShared/Scaffolding/ConcurrentNpcEventInvoker.cs:line 111 at void MicSwitch.Services.ComplexMMDeviceController.set_ActiveController(IMMDeviceController value) in C:/BuildAgent/work/61454f6050c7a045/Sources/MicSwitch/Services/ComplexMMDeviceController.cs:line 92 at MicSwitch.Services.ComplexMMDeviceController(IFactory<MultimediaDeviceController, IMMDeviceProvider> multimediaControllerFactory, IFactory<CollectionMMDevicesController, IReadOnlyObservableCollection> collectionControllerFactory, IMMDeviceProvider deviceProvider)+((IMMDeviceController Previous, IMMDeviceController Current) x) => { } [2] in C:/BuildAgent/work/61454f6050c7a045/Sources/MicSwitch/Services/ComplexMMDeviceController.cs:line 53 at IDisposable PoeShared.Scaffolding.ObservableExtensions.SubscribeSafe(IObservable source, Action onNext, Action onError)+(T x) => { } in C:/BuildAgent/work/61454f6050c7a045/Sources/PoeShared/Scaffolding/ObservableExtensions.cs:line 71`

iXab3r commented 1 year ago

What type of inputs/outputs are you using ? How are they connected?

iXab3r commented 1 year ago

All these exceptions that you're getting basically mean that even if I will handle them micswitch won't be able to mute/unmute device. Probably it is related to issues with audio library that I am using (NAudio). As this issue is not reproducing on any of my PCs I won't be able to find the reason why it breaks, so you probably better try some other solution

nametobechosen commented 1 year ago

I am mainly using a Jabra headset which is connected via bluetooth. In addition there are laptop speaker, laptop mic and camera mic available (but typically not used). The setup is not changed since several months where MicSwitch worked without any problem. No sure when which updates of MicSwitch, Jabra and Windows were done. All are on latest versions.