I created a simple VSTO outlook Add-In project and just wanted to have the functionality of a button in outlook would execute a VBA code that would show the WPF window,
when i ran this, Com addin project, with a WinForms it showed the from both via the debug mode via visual studio and by executing the Outlook and clicking the button which ran the VBA code to execute the com addin, however when i changed it to WPF Window it ran fine from the visual studio, by this i mean that i ran the project, it executed the outlook, then i selected an email and clicked the button, which executed the com addin and showed the WPF form, but as soon as i tried this by running outlook (without the VS environment) it through this error over and over again no matter what i have tried .
i attached the outlookAddin project and VBA code in the following link:
https://www.dropbox.com/sh/sbd9upmxthrigha/AACjx2jfmVZKFcqwQfX6SjCJa?dl=0
if i replace this method in TCMSCom.cs file from the existing (Run WPF Form)
public string OpenConfirmationWizard()
{
// run WPF
TCMSWizard ui = new TCMSWizard();
ui.ShowDialog();
// run winforms
//UserControl1 ui = new UserControl1();
//ui.ShowDialog();
return string.Empty;
}
to this it will run a winforms
public string OpenConfirmationWizard()
{
//TCMSWizard ui = new TCMSWizard();
//ui.ShowDialog();
UserControl1 ui = new UserControl1();
ui.ShowDialog();
return string.Empty;
}
stack trace of the first exception in chain: at System.Windows.Window..ctor() at TCMSCOMAddIn.TCMSWizard..ctor() in C:\Users\eranm\Documents\TFS\PI-HF_TCMSCOMAddIn\Features\TCMSCOMAddIn_Phase1\TCMSCOMAddIn\TCMSWizard.xaml.cs:line 23 at TCMSCOMAddIn.TCMSCom.OpenConfirmationWizard() in C:\Users\eranm\Documents\TFS\PI-HF_TCMSCOMAddIn\Features\TCMSCOMAddIn_Phase1\TCMSCOMAddIn\TCMSCom.cs:line 22
stack trace of the last exception in chain: at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at MS.Internal.FontCache.Util..cctor()
the exceptions messages in chain are like the following:
"the type initializer for 'system.windows.window' threw an exception"
"The type initializer for 'System.Windows.FrameworkElement' threw an exception."
"The type initializer for 'System.Windows.Documents.TextElement' threw an exception."
"The type initializer for 'MS.Internal.FontCache.Util' threw an exception."
"Invalid URI: The format of the URI could not be determined."
i would appreciate your help in resolving this
many thanks,
Eran
StackTrace
and theInnerException
of your type initializer exception. – haindl