Using the typemap code generated by proxygen to create the TypeInfrastructureManager adds entries for the types I've defined as my API as well as almost 1200 entries for classes in mscorlib. If I attempt to pass a marshalByValue object (e.g. System.Data.DataSet) to an addin that is not part of my API or mscorlib I get the exception included at the end of this post.
Do I need to manually add entries to the TypeInfrastructureManager for system classes not part of mscorlib inorder to be able to return them from a method call?
Exception Details:System.Reflection.TargetInvocationException, mscorlib
System.Collections.Generic.KeyNotFoundException, mscorlib
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
Server stack trace:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.VisualStudio.Tools.Applications.TypeInfrastructureManager.GetCanonicalName(TypeDescription localType)
at Microsoft.VisualStudio.Tools.Applications.TypeInfrastructureManager.GetCanonicalName(Type localType)
at Microsoft.VisualStudio.Tools.Applications.RemoteTypeAdapter.System.AddIn.Contract.Automation.IRemoteTypeContract.GetCanonicalName()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.AddIn.Contract.Automation.IRemoteTypeContract.GetCanonicalName()
at Microsoft.VisualStudio.Tools.Applications.TypeInfrastructureManager.LocalTypeFromRemoteType(IRemoteTypeContract typeToFind)
at Microsoft.VisualStudio.Tools.Applications.RemoteParameterInfo.InitializeInfo(MemberInfo parentMember, RemoteParameterData data)
at Microsoft.VisualStudio.Tools.Applications.RemoteParameterInfo..ctor(MemberInfo parentMember, RemoteParameterData data, TypeInfrastructureManager typeInfrastructureManager)
at Microsoft.VisualStudio.Tools.Applications.RemoteMethodInfo..ctor(RemoteType parentType, IRemoteMethodInfoContract contract, TypeInfrastructureManager typeInfrastructureManager)
at Microsoft.VisualStudio.Tools.Applications.RemoteType.CreateCacheMethodInfo(IRemoteMethodInfoContract contract)
at Microsoft.VisualStudio.Tools.Applications.RemoteType.GetMethodImpl(String name, BindingFlags bindingFlags, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetMethod(String name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)