Я недавно столкнулся с проблемой. Я хочу вызвать Lib репозитория объектов QTP, используя C #, но это не работает.
код:
REPOSITORYUTILLib.ObjectRepositoryUtil or = new REPOSITORYUTILLib.ObjectRepositoryUtil();
or.Load(@"C:\Repository.tsr");
or.GetAllObjects();
но я получил System.InvalidCastException
, когда программа работает до or.GetAllObjects();
, я не вижу здесь никакой операции приведения, как я могу получить такое исключение?
У кого-нибудь есть идеи? Спасибо.
вот трассировка стека:
mscorlib.dll!System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(objectarg,System.Type paramType) + 0xe7 bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(System.Runtime.Remoting.Messaging.IMessage msg, object[] outArgs, object returnValue) + 0x88 bytes
mscorlib.dll!System.RuntimeType.ForwardCallToInvokeMember(string memberName, System.Reflection.BindingFlags flags, object target, int[] aWrapperTypes, ref System.Runtime.Remoting.Proxies.MessageData msgData) + 0x26e bytes
test.exe!test.test.Main() lines 14 + 0xf bytes C#
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x6d bytes
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2a bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x63 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x2c bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes