ThrowOnExternalCallFailed() on Windows 10 17763 and lower

Hong 1,046 Reputation points
2019-12-21T12:46:00.957+00:00

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 Monitored
Not Monitored
Tag not monitored by Microsoft.
36,063 questions
{count} votes

2 answers

Sort by: Newest
  1. Roy Li - MSFT 31,886 Reputation points Microsoft Vendor
    2019-12-25T08:13:43.837+00:00

    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.

    0 comments No comments

  2. Barry Wang 61 Reputation points
    2019-12-24T06:18:10.243+00:00

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