The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
LUMIA 930 - Error HRESULT E_FAIL has been returned from a call to a COM component RRS feed

  • Question

  • Hi,

    Lumia 930 users from Netherlands reported issues with 2 of my apps crashing at start up. Finally I was able to collect the crash information. App crashes with the following error.

    "MS.Internal.WrappedException: Error HRESULT E_FAIL has been returned from a call to a COM component. ---> System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.\r\n   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)\r\n   at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, String s)\r\n   at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)\r\n   at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)\r\n   at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)\r\n   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)\r\n   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)\r\n   at Microsoft.Phone.Controls.PhoneApplicationFrame.UpdateMargin(Thickness region, PageOrientation orientation)\r\n   at Microsoft.Phone.Controls.PhoneApplicationFrame.OnApplyTemplate()\r\n   at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)\r\n   --- End of inner exception stack trace ---" string

    I also saw another thread with the exact same error and pattern here. I can re-produce the issue on WP8.1 1080p 5.5 inch emulator. No issues on other emulators. I have a test program I put together to reproduce the issue. OneDrive link to test app here.

    Steps to re-produce the issue

    1) Fire up the 1080p 5.5 inch emulator. By default my emulator uses en-US locale and associated settings for speech, language, keyboard timezone etc.

    2) Just change the Language to Netherlands. Everything else still points to en-US.

    3) Run the code in VS 2013 with target set to 1080p 5.5 inch emulator. The app will raise the Application_UnhandledException event.

    Two key points to note. I have some code to initialize SpeechRecognizer in the Application_Launching event handler. I also have applicationbar on the Panorama page that is the home screen. If I comment out either the Recognizer code in .cs or ApplicationBar in XAML, the app won't crash. Don't know why.

    Really appreciate some insight on this issue.

    Thanks,

    Gilles




    • Edited by G.Joseph Thursday, August 14, 2014 12:06 PM
    Tuesday, August 12, 2014 1:55 AM

All replies

  • Hi Gilles,

    Thanks for reporting this.

    And I was able to reproduce the issue using your project. Just as you mentioned, it only occurs when using the 1080p 5.5 inch emulator with Netherlands language set on emulator.

    Looks like a bug, but I still need some time to confirm this. And will update in the thread once I get some progress on this.

    Thanks,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, August 13, 2014 7:57 AM
  • Hi Alan,

    Thanks for the reply. Please do keep me posted on the progress.

    thanks,

    Gilles

    Wednesday, August 13, 2014 11:14 AM
  • Hi Gilles,

    Thanks for your patience.

    I found this issue is caused by the SpeechRecognizerUI, but I was not able to find out solution for this, and I need to report this issue to our development team for further invetigation. If it is very urgent for you and you would like to get a reliable solution, I will suggest you open a support ticket to Microsoft Phone support from http://support.microsoft.com

    For now, I think I have found a workaround that may get it work, but I need you help to confirm it will work on your side:

    Keep the declaration of SpeechRecognizerUI in app.xaml.cs, and create instance of SpeechRecognizerUI in mainpage's loaded event.

            public MainPage()
            {
                InitializeComponent();
    
                this.Loaded += MainPage_Loaded;
                
                // Set the data context of the listbox control to the sample data
                DataContext = App.ViewModel;
            }
    
            void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
                InitializeVoiceRecognition();
            }
    
            private void InitializeVoiceRecognition()
            {
                try
                {
                    string myCulture = System.Globalization.CultureInfo.CurrentCulture.Name;
                    var localRec = InstalledSpeechRecognizers.All.Where(r => r.Language == myCulture).FirstOrDefault();
    
                    if (localRec == null)
                        localRec = InstalledSpeechRecognizers.All.Where(r => r.Language == "en-US").FirstOrDefault();
    
    
                    App.SpeechRecognizerWithUI.Recognizer.SetRecognizer(localRec);
    
                    string[] yesNoConfirmation = { "Yes", "No" };
                    App.SpeechRecognizerWithUI.Recognizer.Grammars.AddGrammarFromList("YesNo", yesNoConfirmation);
    
                }
                catch (Exception ex)
                {
                    const int privacyPolicyHResult = unchecked((int)0x80045509);
                    const int networkNotAvailable = unchecked((int)0x80045504);
    
                    if (ex.HResult == privacyPolicyHResult)
                    {
                        // User has not accepted the speech privacy policy
                        //this.PromptForSpeechRecognitionPermission();
                    }
                    else if (ex.HResult == networkNotAvailable)
                    {
                        //Dispatcher.BeginInvoke(delegate { MessageBox.Show("Speech " + 
                        //    "recognition requires an active data connection. Please check " +
                        //    "the data connection on your phone and try again.", "Error", MessageBoxButton.OK); });
                    }
                }
            }

    But please note that you need check if the instance of SpeechRecognizerUI is null at everywhere you use it.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, August 14, 2014 7:30 AM
  • Hi Alan,

    I applied your workaround to the test app and it is not crashing any more. I will apply the changes to my real apps and will update you with the status some time this evening. Meanwhile please do report this to the DEV Team for further testing and a possible fix.

    thanks,

    Gilles

    Thursday, August 14, 2014 12:05 PM
  • Hi Alan,

    I tested this with my real code. Even with the proposed work around, the app still raises an Application_UnhandledException.

    System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
    at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
    at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, String s)
    at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
    at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
    at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
    at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
    at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
    at Microsoft.Phone.Controls.PhoneApplicationFrame.UpdateMargin(Thickness region, PageOrientation orientation)
    at Microsoft.Phone.Controls.PhoneApplicationFrame.OnVisibleRegionChange(Object sender, VisibleRegionChangeEventArgs args)
    at Microsoft.Phone.Controls.PhoneApplicationFrame.System.Windows.Controls.IFrame.InternalOnVisibleRegionChange(Object sender, VisibleRegionChangeEventArgs args)
    at System.Windows.Controls.Frame.FireEventHandler[T](EventHandler`1 handler, Object sender, T args)
    at Microsoft.Phone.Controls.PhoneApplicationPage.set_VisibleRegionInPhysicalPixels(RECT value)
    at Microsoft.Phone.Controls.PhoneApplicationPage.UpdateCurrentVisualState()
    at Microsoft.Phone.Controls.PhoneApplicationPage.HandleVisibleRegionChange()
    at Microsoft.Phone.Controls.PhoneApplicationPage.OnVisibleRegionChange()
    at Microsoft.Phone.TaskModel.Interop.Task.FireOnVisibleRegionChange()

    I see the same behavior in the test app too.  I have updated the test app here. Could you please confirm whether you encountered the same issue?

    The good news is that I can prevent crashing by setting e.handled = true in the Application_UnhandledException handler. The bad news is that I have logic in the app to prompt the user to send out the exception report every time the app encounters an exception. So that code is getting triggered every time I launch the app. It is kind of annoying to the user. Anyway to completely eliminate the exception?

    thanks,

    Gilles


    • Edited by G.Joseph Wednesday, August 20, 2014 12:01 AM
    Tuesday, August 19, 2014 11:38 PM
  • Hi Gilles,

    I tried to reproduce the issue with your updated test app. Could you please check whether that is the one you would like to send to me?

    And I found the new app does not have SpeechRecognizerUI related code involved. If it is not related to the previous issue, I will suggest you submit a new question, and I will follow up on that. That will help me to report the issue with a clear definition and avoid confusion on our topic.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, August 21, 2014 8:23 AM
  • Alan,

    Sorry. I had uploaded the wrong. I have uploaded the correct app here.

    thanks,

    Gilles

    Monday, August 25, 2014 1:58 AM
  • Hi Gilles,

    I tested it again with emulator, but still cannot reproduce this issue. Since I donot have lumia 930 on hand, so I cannot test it on the real device.

    And I still cannot find a solid solution for this. I reported this and hope there will be a fix. Thanks for your understanding.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, September 1, 2014 8:03 AM
  • Hi Alan, your code doesn't solve the problem at all; the issue still exist and it's critical.

    To reproduce, start "Emulator 8.1 1080P 5.5 inch" from Visual Studio 2013. Change phone language from English to the different, non-English, language (I've used Russian) - this step is required! I didn't tried other languages but the issue 100% reproducible with Russian lang.

    Now any call of the SpeechRecognizer constructor (var sr = new SpeechRecognizer()) will produce a COM-exception you can't handle at all.

    It's a HUGE and critical bug; I'm curious why MS still ignoring this bug (more than 2 months!)



    WBR, SeNS

    Thursday, October 16, 2014 9:28 PM
  • Hi SeNS,

    Thanks for your feedback.

    Actually, we've already filed a bug on this. I will check the status again and let you know.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Thursday, October 23, 2014 6:24 AM
  • Hi SeNS,

    We have already filed a bug, but we do not have an ETA for the fix yet. If this issue is blocking you and you require a fix for the current version of the Windows Phone operating system, please open a support case by visiting: http://aka.ms/storesupport and then choose the appropriate support category under "App Development". Once you open a support case, one of the engineers from the support team should be able to assist you further.

    Thanks,

    Prashant


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Friday, October 24, 2014 5:27 PM
  • Did anybody find a solution to this issue? Same problem here with my app. :(

    CPDX Developer Blog: http://cpdx-dev.tumblr.com Twitter: @CPDX_Dev Facebook: http://www.facebook.com/CPDXdev Youtube: http://www.youtube.com/user/CPDXdev

    Sunday, October 26, 2014 11:30 AM
  • are there any news?

    I've the same problem with my app.....................

    Tuesday, October 28, 2014 3:27 PM
  • I solved my problem.

    My situation is a bit different:
    I create the SpeechRecognizerUI not in the main page.
    If I don't create the SpeechRecognizerUI I have no problem in my application.
    After I navigate to the page where I call "new SpeechRecognizerUI()" (even if I make the dispose or even if I don't do any other things but "new"), there is the problem (only with 5.5inch emulator, and Lumia 930 I think)
    The exception is raised only if there isn't application bar in a page where I navigate (doesn't matter if I navigate back or forward)... if there is the application bar, there won't be any problem.

    So my workaround is:
    -I derived all page from my class that inherits PhoneApplicationPage.
    -I create a static boolean property SpeechRecognizerUICreated initialized as false. (I will put it as true at the first call of "new SpeechRecognizerUI()"
    -I override the OnNavigatedTo in order to add an empty ApplicationBar if the SpeechRecognizerUICreated was called and the ApplicationBar is null (so I haven't created in the designer) and if the phone model is Lumia 930

    For checking the model name, I used the nuget library PhoneNameResolver

    this is the code:

    public class MyPhoneApplicationPage : PhoneApplicationPage
        {
            public static bool SpeechRecognizerUICreated = false;
            public static bool? IsLumia930 = null;
            protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
            {
                if (SpeechRecognizerUICreated)
                {
                    if (this.ApplicationBar == null)
                    {
                        if (IsLumia930 == null)
                        {
                            try
                            {
                                var manufacturer = Microsoft.Phone.Info.DeviceStatus.DeviceManufacturer;
                                var name = Microsoft.Phone.Info.DeviceStatus.DeviceName;
                                var nameResolved = Ailon.WP.Utils.PhoneNameResolver.Resolve(manufacturer, name);
                                IsLumia930 = string.Compare(nameResolved.CanonicalModel, "Lumia 930", StringComparison.InvariantCultureIgnoreCase) == 0;
                            }
                            catch (Exception)
                            {
    
                                IsLumia930 = false;
                            }
                        }
    
                        if (IsLumia930.Value)
                        {
    
                            this.ApplicationBar = new Microsoft.Phone.Shell.ApplicationBar();
                            this.ApplicationBar.IsVisible = true;
                            this.ApplicationBar.IsMenuEnabled = true;
                        }
                    }
                }
                base.OnNavigatedTo(e);
            }
        }

    The only problem, is that for Lumia930, after the user has used the Voice Command, it will Always see the applicationbar even if empty (if I set it to minimized, it raise exception).

    I've just loaded the update to my app, so I'm not sure that it works for Lumia 930, but it works with the emulator...

    Tuesday, October 28, 2014 5:10 PM
  • I'm having the same error with my app powernAPP:

    http://www.windowsphone.com/s?appid=92740dff-b2e1-4813-b08b-c6429df03356

    The error raises since a couple of months and only on some phone (usually the latest generation, e.g. Lumia 930 and Lumia 735), but I was not able to figure out why. I just know that the error was thrown basically on phones with GERMAN language. Some users reported me, that after changing the language to ENGLISH, there was no error anymore. In addition, Some Lumia 735 users with DENIM update reported my that the error also did not occure when they disabled the virutal buttons.

    Up to now, I didn't knew the error could be related to the SpeechRecognizerUI. I will try to get a Lumia 930/735 device for a couple of hours and to find a workaround.

    I can not understand, why this issue is still present after such a long time. I always thougt one of the big advantages of Windows Phone against Android is that it works the same on every device (screen resolution, etc). But since a couple of months, I know this is not fully true...

    Saturday, December 13, 2014 9:53 AM
  • +1, same problem when I upgraded from a Lumia 920 to Lumia 830.

    My app was (and is) perfectly working on 920/820, but on 830 crashes the same way reported above.

    By disabling the SpeechRecognizerUI, all worked again, but now I'm without speech recognition UI!!!

    My app needs to evolve (possibly without workarounds like Luca's one - thanks & kudos, btw!) and I'm now stuck!


    It's March 2015 and this bug is still around since August 2014 !!???

    Don't we want to have SpeechUI work on latest gen phones, with bigger screens??


    I'm available to Code Review the SpeechRecognizerUI COM component, if anybody @ Microsoft is...

    Thursday, March 19, 2015 4:09 PM
  • I have same problem with Lumia 735.

    My app is perfectly working on 920/820, but on 735 crashes the same way reported above.

    By disabling the SpeechRecognizerUI, all work again, but i can't disable speech recognition UI !

    Someone said bug is already filed, but we do not have reference about it and release date about the fix

    Is anyone have any info on this?
    Friday, May 29, 2015 12:45 PM
  • I have same problem with Nokia 830.
    This is incredible , my customer has 20 wp and now they can not use this characteristic.
    If anyone know something to fix this problem, please tell us.

    Wednesday, June 17, 2015 8:47 AM
  • Hi,

    I have the same problem. When I simple add the line:

    var speechRecognizer = new SpeechRecognizer();

    to a silverlight 8.0 app. It crashes when I use the

    "Emulator 8.1 U1 1080P 5.5inch" or on a Lumia 930 with German language settings (not with english language settings)

    So I need help use Cortana in my app

    Greetings

    Hanno


    Hanno

    Thursday, July 2, 2015 12:49 PM