Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

ncrunch won't load any project
carlbm
#1 Posted : Friday, May 29, 2015 8:58:10 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/29/2015(UTC)
Posts: 5
Location: United Kingdom

Hi
I've just downloaded ncrunch and I've enabled it for a solution that builds correctly in VS.

NCrunch is reporting a load failure for each of the projects in the solution though, with this rather uninformative message:

System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: A token of the wrong type passed to a metadata function. (Exception from HRESULT: 0x8013115F)
at System.Uri.ReCreateParts(UriComponents parts, UInt16 nonCanonical, UriFormat formatAs)
at System.Uri.GetUnescapedParts(UriComponents uriParts, UriFormat formatAs)
at System.Uri.GetComponentsHelper(UriComponents uriComponents, UriFormat uriFormat)
at System.Uri.ToString()
at System.Xml.XmlTextReaderImpl..ctor(String url, XmlNameTable nt)
at System.Xml.XmlTextReader..ctor(String url)
at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath)
at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext)
at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, IDictionary`2 globalProperties, String toolsVersion, ILoggingService loggingService, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext)
at Microsoft.Build.Construction.ProjectRootElement.<>c__DisplayClass1.<OpenProjectOrSolution>b__0(String path, ProjectRootElementCache cache)
at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded)
at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ILoggingService loggingService, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext, Boolean isExplicitlyLoaded)
at Microsoft.Build.Evaluation.Evaluator`4.<>c__DisplayClass6.<ExpandAndLoadImports>b__2(String p, ProjectRootElementCache c)
at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, String importExpressionEscaped, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCache projectRootElementCache, BuildEventContext buildEventContext, ProjectInstance projectInstanceIfAnyForDebuggerOnly)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project..ctor(XmlReader xmlReader, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
at nCrunch.VSIntegration2010.MSBuildIntegration.BuildableProject2010.Initialise(BuildXml buildXml, FilePath projectFilePath)
at nCrunch.Compiler.RemoteBuildRunner.(FilePath ,   , String , String , DirectoryPath , String )
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage )
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteInstance.[T](Byte[] )
at nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate)
at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , ProcessorArchitecture , GridClientId , IBuildableProject , CustomEnvironmentVariable[] )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate, ProcessorArchitecture processorArchitecture, VisualStudioVersion vsVersion, CustomEnvironmentVariable[] customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentFactory.(ProcessorArchitecture )
at nCrunch.Client.ComponentLoader.SnapshotComponentFactory.CreateSnapshotComponentFromXml(FilePath projectFilePath, BuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, ISnapshotConfig snapshotConfig, VisualStudioVersion vsVersion)



Please help!
Remco
#2 Posted : Friday, May 29, 2015 12:25:02 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

This is an exception thrown by MSBuild when it tries to interpret the XML of your project file.

Has the project file been hand-coded or heavily customised? Which template was used in its creation? Do you experience this problem on a fresh new solution using one of the standard VS project templates?
carlbm
#3 Posted : Friday, May 29, 2015 1:03:57 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/29/2015(UTC)
Posts: 5
Location: United Kingdom

They are all standard projects.
MVC 4, some standard class projects and a few MStest projects.
No project files have been modified.

I created a new console app and I had the same problem when I enabled ncrunch.
carlbm
#4 Posted : Friday, May 29, 2015 1:49:23 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/29/2015(UTC)
Posts: 5
Location: United Kingdom

I've installed ncrunch on a different machine and the solution gets further. It doesn't fully load, but it doesn't have an exception next to each project either.
What could be wrong with the MSBuild/projects to make it do this?

I can send you a sample project file if you'd like?
Remco
#5 Posted : Saturday, May 30, 2015 12:54:53 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
carlbm;7377 wrote:
I can send you a sample project file if you'd like?


Absolutely - this would be a huge help. Could you submit it through the contact form? https://www.ncrunch.net/support/contact.
carlbm
#6 Posted : Saturday, May 30, 2015 2:04:21 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/29/2015(UTC)
Posts: 5
Location: United Kingdom

It's now loading all the projects on a different computer, but I am still having no luck using the initial pc.
On the PC where it's working i'm having a different problem now. I'm using Autofixture and AutoMoq with Nunit. The tests run fine using the resharper runner or the testdriven.net runner. They are reporting problems (consistently failing the same tests, but the tests seem fairly randomly from what I can tell) with this message:

NCrunch was unable to locate this test during NUnit's execution run. This problem can be caused by tests with names that contain random elements, such as through the use of NUnit's RandomAttribute. Please ensure your test is named consistently or consider changing your 'Framework utilisation type for NUnit' solution-level configuration setting to 'StaticAnalysis'.

The odd thing about this is that I am using the same process elsewhere in the same project and the tests are reporting as pass or fail.

This one fails:

Code:

[TestFixture]
    public class ClientTests
    {
        [Test]
        [AutoMoqData]
        public void ClientStringifyReadsCorrectly(Client sut)
        {
            // Arrange

            // Act
            var result = sut.ToString();

            // Assert
            Assert.AreEqual("Client: " + sut.Name + ": " + sut.Id, result, "Result is in the wrong format");
        }
    }


while this one passes (in the same project)
Code:

[TestFixture]
    public class GetEventAnswersTests
    {
[Test, AutoMoqData]
        public void QuestionEvent_NoAnswer(
            QuestionEvent instanceEvent
            )
        {
            // Arrange
            instanceEvent.Answer = null;

            // Act
            var result = instanceEvent.GetAnswers();

            // Assert
            Assert.AreEqual(0, result.Count);
        }
...


The only difference that I can see is that one has only one test in the class while the other has multiple tests.
Actually, I turned the second example into a class with only one test and it still passes.

Any help on this? I'd really like to try your product!
carlbm
#7 Posted : Saturday, May 30, 2015 2:06:47 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/29/2015(UTC)
Posts: 5
Location: United Kingdom

PS I saw that there was another difference, that there were two lines of attributes on the failing test. I changed it into one
([Test, AutoMoqData]) and it didn't fix the issue.
Remco
#8 Posted : Saturday, May 30, 2015 9:20:01 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
The auto-mocking issue is likely to be caused by inconsistencies in the test name.

Because NCrunch needs to uniquely identify a test by its name (which in the instance of a testcase, is generated from its parameters), there is a known issue where having a test with a name that is inconsistent or randomly generated will cause the NCrunch to be unable to locate the test during the execution run.

There are two ways to solve this problem:

1. Avoid using arrangements where test names are not unique - likely this would mean not using automoq.
2. Set the 'framework utilisation type' for NUnit to StaticAnalysis (solution-level NCrunch configuration setting). It is unknown to me whether StaticAnalysis will work with automoq, as this depends upon how it is implementing its own internal logic. There is a strong possibility that StaticAnalysis will not work with automoq.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.069 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download