WgServerforWindows icon indicating copy to clipboard operation
WgServerforWindows copied to clipboard

"An event was unable to invoke any of the subscribers"

Open lands39 opened this issue 1 year ago • 9 comments

what happened? how do i fix this?

image

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040201): An event was unable to invoke any of the subscribers (0x80040201) at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type) at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 146 at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve() in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 52 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at GalaSoft.MvvmLight.Helpers.WeakAction.Execute() at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter) at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.Runtime.InteropServices.COMException (0x80040201): An event was unable to invoke any of the subscribers (0x80040201) at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type) at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 146 at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve() in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 52

lands39 avatar Dec 13 '24 04:12 lands39

I got the same problem

tungnb avatar Dec 13 '24 07:12 tungnb

I got the same problem

how recent did this happen? for me, it just happened out of nowhere today after i reconnected to my wireguard vpn. tried reinstalling it completely which did not help. ended up "fixing" it by enabling hyperv and using NAT, this does not solve the root cause though. system i'm having issues with is on win10 22H2 pro and is fully up to date. clients connecting are primarily linux based.

lands39 avatar Dec 13 '24 08:12 lands39

Hi folks, it looks like you're hitting a known issue documented in the README. Please take a look there and let me know if the workaround helps!

https://github.com/micahmo/WgServerforWindows?tab=readme-ov-file#inability-to-enable-internet-sharing

micahmo avatar Dec 13 '24 15:12 micahmo

noted. i did switch to NAT which needed hyperv and created a virtual adapter for VMs. NAT seems to actually work much better with my setup and i was able to disable that virtual adapter with no ill effects, so i think i'll use NAT. Thanks!

lands39 avatar Dec 14 '24 07:12 lands39

I'm glad to hear that! Yes, NAT Routing is a much better option if available on your system. I'm glad to hear it's working for you. If it's alright, I will go ahead and close this issue.

micahmo avatar Dec 14 '24 22:12 micahmo

is there a way i can prevent windows from creating "vethernet adapter"? this is turning out to cause more problems because its assigning IPs that conflict with my network

lands39 avatar Dec 17 '24 02:12 lands39

It might help to change the range of IPs used by devices on your WireGuard network (Edit server configuration > Address). You can also change the range used by NAT routing (NAT Routing > Disable/Enable NAT dropdown button > Specify custom NAT network range), so that you can share the network with other adapters (see #110).

micahmo avatar Dec 17 '24 16:12 micahmo

NAT isn't interfering with the wg server, its interfering with the addressing used by my LAN which cannot be changed

lands39 avatar Dec 17 '24 17:12 lands39

having this issue again. how do i fix it? i remember i did something in ncpa.cpl but i forgot what i did

lands39 avatar May 21 '25 17:05 lands39