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

Notification

Icon
Error

Project load failure
LucasT
#1 Posted : Thursday, June 25, 2015 12:00:25 PM(UTC)
Rank: Member

Groups: Registered
Joined: 6/25/2015(UTC)
Posts: 11
Location: France

Was thanked: 1 time(s) in 1 post(s)
Hi,

I've successfully used NCrunch in a number of solutions so far (great product BTW), but I have one project which refuses to load (The Status column says "Load failure").

The Tests window shows the following stack trace:

Code:

System.Xml.XmlException: Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2.
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ParseQName(Boolean isQName, Int32 startOffset, Int32& colonPos)
   at System.Xml.XmlTextReaderImpl.ParseElement()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options)
   at nCrunch.Client.ComponentLoader.ParsedBuildXml..ctor(BuildXml buildXml, FrameworkVersion defaultFrameworkVersion)
   at nCrunch.Client.ComponentLoader.SnapshotComponentFactory.(FilePath )
   at nCrunch.Client.ComponentLoader.SnapshotComponentFactory.(ComponentBuildAnalysisResult )
   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)


I'm using NCrunch 2.15.0.9 with VS 2013 Update 4.

I've tried to change several configuration options without success.

The projectFilePath parameter name made me look at the csproj and nchrunchproject files. Both are well-formed XML and don't contain NULL characters. Changing encodings didn't fix the issue either.

In case it matters, the failing project isn't a test project, but one of the assembles under test. It's a ReSharper plugin.
Remco
#2 Posted : Thursday, June 25, 2015 12:17:44 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,

Thanks for sharing this issue.

This problem is originating from the code responsible for loading the project XML into memory. This means that the source of the XML exception is actually the project file itself.

Something particularly strange about this is how Visual Studio is able to load a project file with an invalid XML structure. I would expect that before NCrunch would fail, VS should fail ... Can you tell me a bit more about this project? Does the XML inside the project file seem valid and well formed? Or is this a JSON based project file? (note that these aren't supported by NCrunch yet).
LucasT
#4 Posted : Thursday, June 25, 2015 12:50:39 PM(UTC)
Rank: Member

Groups: Registered
Joined: 6/25/2015(UTC)
Posts: 11
Location: France

Was thanked: 1 time(s) in 1 post(s)
The project is a C# library (so a standard XML MSBuild file), and I double-checked it's well-formed.
I tried to remove the BOM but it didn't change the outcome.

(my previous message was a mistake, the file was still locked by the hex editor, so VS didn't load it and NCrunch didn't complain).
LucasT
#5 Posted : Thursday, June 25, 2015 1:08:22 PM(UTC)
Rank: Member

Groups: Registered
Joined: 6/25/2015(UTC)
Posts: 11
Location: France

Was thanked: 1 time(s) in 1 post(s)
OK, I finally fixed the problem.

The project imports a lot of third-party target files (specifically: the JetBrains SDK). Some of these files were encoded in UTF-16... without a BOM.
MSBuild loads them just fine, but XDocument seems unable to cope with them. This explains the \x00 byte error.

Adding a BOM to these files fixed the issue.

The problem here is that these files come from a NuGet package, so it'd be nice if NCrunch could support them.
Remco
#6 Posted : Thursday, June 25, 2015 10:07:15 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)
LucasT;7432 wrote:
OK, I finally fixed the problem.

The project imports a lot of third-party target files (specifically: the JetBrains SDK). Some of these files were encoded in UTF-16... without a BOM.
MSBuild loads them just fine, but XDocument seems unable to cope with them. This explains the \x00 byte error.

Adding a BOM to these files fixed the issue.

The problem here is that these files come from a NuGet package, so it'd be nice if NCrunch could support them.


Interesting. Thanks for letting me know about this. Maybe I can find a better way to load this XML so it doesn't bug out so badly. Can you share any more details about how the files were imported? Was this just using an <Import> tag?
LucasT
#7 Posted : Thursday, June 25, 2015 10:16:57 PM(UTC)
Rank: Member

Groups: Registered
Joined: 6/25/2015(UTC)
Posts: 11
Location: France

Was thanked: 1 time(s) in 1 post(s)
Yes, it was an <Import> tag.

If you want to reproduce it, it's just a matter of: Install-Package JetBrains.ReSharper.SDK

Here's an example project file from another ReSharper plugin. Not all of the included files are UTF-16 without BOM, but most of them are.
Remco
#8 Posted : Thursday, June 25, 2015 10:36:54 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)
Excellent, thanks! I'll see what I can do.
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.044 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download