我正在构建MS Word VSTO加载项。它已成功使用,但在64位Word安装上使用时抛出错误。发生以下堆栈跟踪:
2019-06-05 15:57:17,448 [VSTA_Main] INFO Office.Infrastructure.Word.TaskPaneVisibilityHandler - Using DPI scaling factor: 1
2019-06-05 15:57:23,580 [VSTA_Main] FATAL XXX.ErrorReporting.ErrorReportingModule - Unhandled exception in dispatcher thread
System.OverflowException: Arithmetic operation resulted in an overflow.
at System.IntPtr.op_Explicit(IntPtr value)
at Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.AllocateAndMarshalButtons(TASKDIALOG_BUTTON[] structs)
at Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.MarshalDialogControlStructs()
at Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.NativeShow()
at Microsoft.WindowsAPICodePack.Dialogs.TaskDialog.ShowCore()
at Microsoft.WindowsAPICodePack.Dialogs.TaskDialog.Show()
at XXX.Infrastructure.Interactivity.TaskDialogAction.Invoke(Object parameter)
at System.Windows.Interactivity.TriggerBase.InvokeActions(Object parameter)
at Prism.Interactivity.InteractionRequest.InteractionRequest`1.Raise(T context, Action`1 callback)
at XXX.Workspace.ViewModels.WorkspaceOptionsViewModel.ConfirmCreateWorkspaceFolder()
at XXX.Workspace.ViewModels.WorkspaceOptionsViewModel.CreateSaveOptionsAction(Action& saveAction)
at XXX.Options.Services.OptionsService.SaveOptions()
at XXX.Onboarding.ViewModels.WorkspaceViewModel.NavigateToNext()
at Prism.Commands.DelegateCommandBase.<>c__DisplayClass5_0.<.ctor>b__0(Object arg)
at Prism.Commands.DelegateCommandBase.<Execute>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Prism.Commands.DelegateCommandBase.<System-Windows-Input-ICommand-Execute>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
----- End of application log -----
我相信是来自代码:
private bool ConfirmCreateWorkspaceFolder()
{
bool isConfirmed = false;
this.CreateWorkspaceFolderConfirmation.Raise(new TaskDialogConfirmation
{
Title = Infrastructure.Properties.Resources.ApplicationName,
Content = "The selected workspace folder does not exist. Create it now?",
ConfirmPrompt = "Create folder",
Type = TaskDialogNotificationType.Warning
}, c => isConfirmed = c.Confirmed);
return isConfirmed;
}
有人可以指出可能发生问题的方向吗?谢谢。