question

zipswich avatar image
0 Votes"
zipswich asked ·

ThrowOnExternalCallFailed() on Windows 10 17763 and lower

An app with Target version: 18362 and Min version: 16299 works flawlessly on Windows 10 18362, 18363, but it throws exceptions by System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed on 17763 and lower:

From 17763:

 Exception from OnLaunched():
 The text associated with this error code could not be found.
    
 Cannot create instance of type 'Microsoft.Advertising.WinRT.UI.AdControl' [Line: 0 Position: 0]
  Stack Trace:   at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
    at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, Type__Impl.UnsafeType, Void*, Void*) + 0xd5
    at Windows.UI.Xaml.Controls.IFrame__Impl.Stubs.Navigate(__ComObject, Type, Object) + 0x8e

From 16299:

 Exception: The text associated with this error code could not be found.
     
  Cannot find a Resource with the Name/Key UseSystemFocusVisuals [Line: 0 Position: 0]
  Type: Windows.UI.Xaml.Markup.XamlParseException
  Stack trace:    at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
     at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, Type__Impl.UnsafeType, Void*, Void*) + 0xd5
     at Windows.UI.Xaml.Controls.IFrame__Impl.Stubs.Navigate(__ComObject, Type, Object) + 0x8e

Could anyone shed some light on this?




not-supported
· 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.

Cannot create instance of type 'Microsoft.Advertising.WinRT.UI.AdControl', from the first error, it looks AdControl was not create correctly, could you share your code or sample that could reproduce this issue ?

0 Votes 0 · ·

Those exceptions are from the app's analytics reported from users' computers. I will try to find a computer with an older version of Windows 10 to try to reproduce it and report back.

0 Votes 0 · ·

Great, if you have some new info, please insert it to the case update.

0 Votes 0 · ·
barrywang0526 avatar image
0 Votes"
barrywang0526 answered ·

Looks like a threading issue here. Can you make sure that your code of showing the Ad is wrapped in Dispatcher?

· 3 · Share
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.

There is no C# code. The AdControl is placed and configured in Xaml. Again it works flawlessly on Windows 10 18362, 18363.

0 Votes 0 · ·

There is no C# code involved. AdControl is placed in a Xaml file.

0 Votes 0 · ·

I test with blank and add the following code, it works well in 17763, I could not reproduce this issue.
alt text


0 Votes 0 · ·
RoyLi-MSFT avatar image
0 Votes"
RoyLi-MSFT answered ·

Hello,

Welcome to Microsoft Q&A!

Thank you for using MicrosoftQ&A! Microsoft Q&A is now in a public review version. Questions about AdSDK is not fully supported here. If you have questions about AdSDK, please move to the AdSDK Integration & Ad Mediation forum.


· Share
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.