question

zipswich avatar image
0 Votes"
zipswich asked ·

Why does new AudioStreamDescriptor() occasionally throws "Class not registered (Exception from HRESULT: 0x80040154)"

 AudioEncodingProperties aep = AudioEncodingProperties.CreatePcm(8000, 1, 16)
 audioDescriptor = new AudioStreamDescriptor(aep)

The above code works most of the time. An app's analytics reports that new AudioStreamDescriptor(aep) occasionally throws:

System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154)
Stack Trace:
at System.Runtime.InteropServices.ExternalInterop.RoGetActivationFactory(String, Guid&, IntPtr&) + 0x197
at System.Runtime.InteropServices.FactoryCache.GetActivationFactoryInternal(String, RuntimeTypeHandle, ContextEntry) + 0x4a
at System.Runtime.InteropServices.FactoryCache.GetActivationFactory(String, RuntimeTypeHandle, Boolean) + 0x6c
at System.Runtime.InteropServices.McgMarshal.GetActivationFactory(String, RuntimeTypeHandle) + 0x24
at Windows.Media.Core.AudioStreamDescriptor.__Factory_Windows_Media_Core__IAudioStreamDescriptorFactory_Create(String, AudioEncodingProperties) + 0x1b
at Windows.Media.Core.AudioStreamDescriptor..ctor(AudioEncodingProperties) + 0x21

Could anyone shed some light on the possible causes of this?

windows-uwp
· 3
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @zipswich
For 0x80040154 error, it is a typical ‘class not registered’ error message. The 0x80040154 error causes include a lot of reasons such as
Incompatible software Invalid entry command path Damaged and corrupt DLL files COM components not properly registered.
We can't detect the problem without the sample code just with above error info, it's hard to reproduce your problem.

1 Vote 1 ·

Thank you for the elucidation. Your comment can the answer for me to accept.

1 Vote 1 ·

No bother, I will post the answer below, and thanks for your feed back.

1 Vote 1 ·

1 Answer

NicoZhu-MSFT avatar image
1 Vote"
NicoZhu-MSFT answered ·

Hello, @zipswich Welcome to Microsoft Q&A,

For 0x80040154 error, it is a typical ‘class not registered’ error message. The 0x80040154 error causes include a lot of reasons such as
Incompatible software Invalid entry command path Damaged and corrupt DLL files COM components not properly registered.



If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.