xenolightning / AudioSwitcher

.NET Library which facilitates interacting with Audio Devices on Windows
Microsoft Public License
248 stars 53 forks source link

Error with Activator.CreateInstance() Type.GetTypeFromCLSID(new Guid(ComInterfaceIds.DEVICE_ENUMERATOR_CID)); #61

Open ZaCkOX opened 1 year ago

ZaCkOX commented 1 year ago

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MethodAccessException: Method System.ComObject..ctor()' is inaccessible from method System.ComObject..ctor()'.

I have tried changing all internals to public, is it possible something else is wrong? This is on a Windows 10. Not sure what else you would need to know...

Thank you

xenolightning commented 1 year ago

That's pretty strange. It shouldn't be related to class access modifiers. It looks like it's having an issue creating the underlying com object.

What version of Windows and .NET are you running?