开发者

Is NUnit broken with Windows7 for C++/CLI?

开发者 https://www.devze.com 2023-01-01 14:59 出处:网络
NUnit is failing in C++/CLI with a System.IO.FileNotFoundException. I have tried my own freshly-created project, the C++/CLI sample included with NUnit and the one from CodeProject How to use NUnit t

NUnit is failing in C++/CLI with a System.IO.FileNotFoundException.

I have tried my own freshly-created project, the C++/CLI sample included with NUnit and the one from CodeProject How to use NUnit to test native C++ code using Visual Studio 2008sp1 with NUnit 2.5.5 as well as 2.4.8. I installed 2.4.8 just on C:\ in case there was something weird about paths with spaces such as Program Files (x86).

I have no problems with a C# sample using NUnit.

in NUnit GUI, all of these C++/CLI projects encounter the same problem, on attempting to open the projects.

I'd really like to use NUnit but for now have had to go back to standard Microsoft tests

System.IO.FileNotFoundException...

Server stack trace: 
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String code开发者_JAVA百科Base, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
   at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
   at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
   at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
   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.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 NUnit.Core.TestRunner.Load(TestPackage package)
   at NUnit.Util.TestDomain.Load(TestPackage package)
   at NUnit.Util.TestLoader.LoadTest(String testName)


I had what sounds like the same problem but via the NUnit console. It turned out that the NUnit console was JIT compiling to x64 rather than x86 and my C++/CLI assembly was x86. They need to be the same to work so I used the x86 specific version of the console. See http://www.nunit.org/index.php?p=nunit-console&r=2.4.8.

Hope this helps,

Matt

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号