MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
231 stars 499 forks source link

Under what circumstances can this call throw an exception? #2348

Closed mc0re closed 1 year ago

mc0re commented 1 year ago

I've got the following crash information:

System.Exception: Element not found. (Exception from HRESULT: 0x80070490)

Call stack ends with:

System.Runtime.InteropServices
McgMarshal.ThrowOnExternalCallFailed (Int32, RuntimeTypeHandle)
__Interop
ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32, Int32, Void*)
Windows.Media.Devices.IMediaDeviceStatics__Impl
Stubs.GetDefaultAudioRenderId (__ComObject, AudioDeviceRole)

The call in question looks as following:

var defaultId = MediaDevice.GetDefaultAudioRenderId(AudioDeviceRole.Default);

The function documentation is missing a description of this exception.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

drewbatgit commented 1 year ago

@mc0re - Hello, I reached out to the feature team and they state that this API should not throw an exception under normal operating conditions. Even if there is no endpoint, the API should return an empty string and not return an error. So, it sounds like there may be something going on with your particular environment that is causing this to throw. Unfortunately, git issues in this repo are specifically for documentation issues and we are not able to provide direct developer support here. I recommend that you open an issue on the Microsoft Q&A site.