Windows Phone 8 Service Call causes Error HRESULT E_FAIL has been returned from a call to a COM component

馋奶兔 提交于 2019-12-13 08:47:00

问题


When making a typical Service Call it is causing an error Error HRESULT E_FAIL has been returned from a call to a COM component

var response = await ServiceManager.SendRequestAsync<GetOptionsResponse>(request);

This error is only occurring when I make a service call from this page, if I call the same method from another page it works fine.

The error causes the response to not be returned and the whole App crashes.

Any ideas?


回答1:


It turns out that it actually wasn't the Service Call, just any method that was awaited allowing, the Main UI thread to return to loading the Page.

When the page was loaded there was an error in the XAML that caused the entire App to Crash.

Turns out it was this line in the xaml

FontWeight=" {Binding Path=SatisfactionSurveyStyles.SelectedListBoxItemFontWeight, Source={StaticResource LocalizationFiles}}"

There should be no space between " {

FontWeight="{Binding Path=SatisfactionSurveyStyles.SelectedListBoxItemFontWeight, Source={StaticResource LocalizationFiles}}"

I removed the space and it works fine now, since XAML errors aren't picked up by the Compiler it was hard to track down, also since Microsoft is notorious for misleading Error Messages when I read

Error HRESULT E_FAIL has been returned from a call to a COM component

It wasn't very helpful. Anyways it works now, lesson learned, spaces can be deadly... >)



来源:https://stackoverflow.com/questions/33550709/windows-phone-8-service-call-causes-error-hresult-e-fail-has-been-returned-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!