[英]WPF Window within VSTO outlook AddIn project
我创建了一个简单的VSTO Outlook外接程序项目,只是想让Outlook中的按钮功能执行将显示WPF窗口的VBA代码,
当我运行这个带有WinForms的Com插件项目时,它通过Visual Studio的调试模式和执行Outlook并单击运行VBA代码以执行com插件的按钮来显示,但是当我将其更改为WPF窗口在Visual Studio中运行良好,这意味着我运行了项目,执行了Outlook,然后我选择了一封电子邮件并单击按钮,该按钮执行了com插件并显示了WPF表单,但是只要我通过反复运行Outlook(没有VS环境)来尝试此操作,无论我尝试了什么,都反复执行此错误。
我在以下链接中附加了outlookAddin项目和VBA代码:
https://www.dropbox.com/sh/sbd9upmxthrigha/AACjx2jfmVZKFcqwQfX6SjCJa?dl=0
如果我从现有的TCMSCom.cs文件中替换此方法(运行WPF表单)
public string OpenConfirmationWizard()
{
// run WPF
TCMSWizard ui = new TCMSWizard();
ui.ShowDialog();
// run winforms
//UserControl1 ui = new UserControl1();
//ui.ShowDialog();
return string.Empty;
}
为此,它将运行一个winforms
public string OpenConfirmationWizard()
{
//TCMSWizard ui = new TCMSWizard();
//ui.ShowDialog();
UserControl1 ui = new UserControl1();
ui.ShowDialog();
return string.Empty;
}
链中第一个异常的堆栈跟踪:在C:\\ Users \\ eranm \\ Documents \\ TFS \\ PI-HF_TCMSCOMAddIn \\ Features \\ TCMSCOMAddIn_Phase1 \\ TCMSCOMAddIn中的TCMSCOMAddIn.TCMSWizard..ctor()的System.Windows.Window..ctor() \\ TCMSWizard.xaml.cs:TCMSCOMAddIn.TCMSCom.OpenConfirmationWizard()的第23行位于C:\\ Users \\ eranm \\ Documents \\ TFS \\ PI-HF_TCMSCOMAddIn \\ Features \\ TCMSCOMAddIn_Phase1 \\ TCMSCOMAddIn \\ TCMSCom.cs:第22行
链中最后一个异常的堆栈跟踪:在System.Uri.CreateThis(String uri,Boolean dontEscape,UriKind uriKind)在MS.Internal.FontCache.Util..cctor()
链中的异常消息如下所示:
“'system.windows.window'的类型初始化程序引发了异常”
“'System.Windows.FrameworkElement'的类型初始值设定项引发了异常。”
“'System.Windows.Documents.TextElement'的类型初始值设定项引发了异常。”
“'MS.Internal.FontCache.Util'的类型初始值设定项引发了异常。”
“无效的URI:无法确定URI的格式。”
我会很感激您在解决这个问题上的帮助
非常感谢,
伊朗
好的,该错误已修复,
问题是注册表中环境中的path变量设置为超过2048个字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.