0
我在寫一個小型的iframe託管的XBAP,需要與主機頁面進行交互。 我首先寫了一個小POC,看看我所需要的是否可能。XBAP腳本互操作失敗
這裏的頁面構造函數的代碼:
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
「警戒」 線拋出一個異常:
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無法加載(甚至在警報行之前)。
謝謝分配!