I am encountering an exception when attempting to access an object in the host application. The addin uses an interface to access the host object:
public interface InvoiceInterface
{
string invoice { get; }
}
The host object implements the interface:
[Serializable]
public abstract class Invoice : Trade.Interface.TransactionDataManager.Billing.InvoiceInterface
{
public string invoice
{
get { return _invoice; }
set { _invoice = value; }
}
string _invoice = "";
}
public class HostTypeMapProvider : Microsoft.VisualStudio.Tools.Applications.Runtime.ITypeMapProvider
{
System.Collections.Generic.Dictionary<System.Type, System.String> typeToCanonicalName = null;
System.Collections.Generic.Dictionary<System.String, System.Type> canonicalToTypeName = null;
internal HostTypeMapProvider()
{
typeToCanonicalName = new System.Collections.Generic.Dictionary<System.Type, string>();
canonicalToTypeName = new System.Collections.Generic.Dictionary<string, System.Type>();
canonicalToTypeName.Add("Trade.Interface, Trade.Interface.TransactionDataManager.Billing.InvoiceInterface", typeof(Trade.Interface.TransactionDataManager.Billing.InvoiceInterface));
typeToCanonicalName.Add(typeof(Trade.Interface.TransactionDataManager.Billing.InvoiceInterface), "Trade.Interface, Trade.Interface.TransactionDataManager.Billing.InvoiceInterface");
}
public string GetCanonicalNameForType(System.Type type)
{
if (typeToCanonicalName.ContainsKey(type))
{
return typeToCanonicalName[type];
}
return null;
}
public System.Type GetTypeForCanonicalName(string canonicalName)
{
if (canonicalToTypeName.ContainsKey(canonicalName))
{
return canonicalToTypeName[canonicalName];
}
return null;
}
}
I have successfully passed objects using an interface between the host application and addin, but for some reason I receive an exception on this rather simple implementation.
Can someone give me a few pointer on other areas to evaluate? Also, the proxy and addin build correctly.
Thanks.
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.VisualStudio.Tools.Applications.ExceptionFilterHelper.DynamicInvoke(IExceptionManager mgr, IExceptionNotificationObject exceptionNotificationObject, IRemoteDelegateContract delegateContract, IRemoteArgumentArrayContract remoteArgs, TypeInfrastructureManager typeInfrastructureManager) +119
Microsoft.VisualStudio.Tools.Applications.DelegateProxy.InvokeDelegate_V_Return(A0 a0) +592
Microsoft.VisualStudio.Tools.Applications.DelegateProxy.InvokeDelegate_V_NoReturn(A0 a0) +47
DocumentManager.VSTA.VSTADocumentFieldMapper.ExecuteReadMappingScript(Draw draw, Boolean readOnly, HttpResponse response) in D:\development projects\ddm-winfx-3.5\src\DocumentManager\VSTA\VSTADocumentFieldMapper.cs:79
DocumentManager.PDF.ManageFDF.BuildFDF(HttpResponse response) in D:\development projects\ddm-winfx-3.5\src\DocumentManager\PDF\CreateDocumentFDF.cs:61
Trade.docs.FDF.Page_Load(Object sender, EventArgs e) in D:\development projects\ddm-winfx-3.5\src\TradeWeb\docs\FDF.aspx.cs:76
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436