我正在编写一个需要与主机页面交互的小型iframe托管的XBAP。
我先写了一个小POC,看看我所需要的一切都是可能的。
这是页面构造函数的代码:
Public Sub New()
' This call is required by the designer.
InitializeComponent()
Try
Dim scriptObject = BrowserInteropHelper.HostScript
scriptObject.alert("blablabla")
Catch ex As Exception
MessageBox.Show(ex.ToString(), "Sign error", MessageBoxButton.OK, MessageBoxImage.Error)
End Try
End Sub
“alert”行抛出下一个异常:
System.TypeAccessException: Attempt by method 'DynamicClass.CallSite.Target(System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.CallSite, System.Object, System.Object ByRef)' to access type 'System.Runtime.CompilerServices.CallSite`1<Microsoft.VisualBasic.CompilerServices.IDOUtils+SiteDelegate1>' failed.
at CallSite.Target(Closure , CallSite , Object , Object& )
at Microsoft.VisualBasic.CompilerServices.IDOUtils.CreateRefCallSiteAndInvoke(CallSiteBinder Action, Object Instance, Object[] Arguments)
at Microsoft.VisualBasic.CompilerServices.IDOBinder.IDOCall(IDynamicMetaObjectProvider Instance, String MemberName, Object[] Arguments, String[] ArgumentNames, Boolean[] CopyBack, Boolean IgnoreReturn)
at SignVerify.Web.XBAP.Page1..ctor()
这在IE 64位中发生,IE 32位整个XBAP无法加载(甚至在警报线之前)。
感谢分配!
答案 0 :(得分:0)