COM Exception on AccountUpdated
-
2012년 4월 18일 수요일 오전 11:09
Hello,
I get a COM exception while accesing to CurrentNetwork property of MobileBroadbandAccount object after AccountUpdated event(Event get fired due to disconnection).
The exception description is below:
Transition into COM context 0x1018f50 for this RuntimeCallableWrapper failed with the following error: An outgoing call cannot be made since the application is dispatching an input-synchronous call. (Exception from HRESULT: 0x8001010D (RPC_E_CANTCALLOUT_ININPUTSYNCCALL)). This is typically because the COM context 0x1018f50 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else and cannot process the context transition. No proxy will be used to service the request on the COM component and calls will be made to the COM component directly. This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them.
I acces the Account object ,which is created in a non-UI thread, inside UI thread. If i dont access from the UI thread the exception does not get throwed. Why this happens?
Thanks
Mehmet
- 편집됨 mehmet6parmak 2012년 4월 18일 수요일 오전 11:11
- 편집됨 mehmet6parmak 2012년 4월 18일 수요일 오전 11:12
모든 응답
-
2012년 4월 19일 목요일 오후 5:04중재자
I will look into this for you.
Best Wishes - Eric
-
2012년 5월 5일 토요일 오전 12:42
Hi Mehmet,
If you create an object in a UI thread you can’t access it from a non-UI thread and vice versa. Instead you have to use the pattern we have in the Mobile broadband account and device management sample at http://code.msdn.microsoft.com/windowsapps/Mobile-Broadband-API-Sample-7debc1ff, which is to have the callback function ask the dispatcher to do the work on the UI thread. The following is an excerpt from the C# sample.
-Jack
networkAccountWatcher.AccountAdded += (sender, args) => { string message = "[accountadded] "; try { message += args.NetworkAccountId; var account = MobileBroadbandAccount.CreateFromNetworkAccountId(args.NetworkAccountId); message += ", service provider name: " + account.ServiceProviderName; } catch (Exception ex) { message += ex.Message; } DisplayWatcherOutputFromCallback(message); }; … async void DisplayWatcherOutputFromCallback(string value) { await Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal, () => { WatcherOutput.Text = value; }); }
- 답변으로 제안됨 Jack Tao [MS]Microsoft Employee 2012년 5월 5일 토요일 오전 12:42
- 답변으로 표시됨 Bob_BaoMVP, Moderator 2012년 5월 7일 월요일 오전 10:26

