Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuget Pack throws System.Xml.XmlException: Unrecognized root element in Core Properties part. Line 2, position 2. #1921

Closed
Luzenna opened this issue Jan 12, 2016 · 18 comments

Comments

@Luzenna
Copy link

Luzenna commented Jan 12, 2016

When using Nuget Pack with version 3.3.0 it throws the following error: System.Xml.XmlException: Unrecognized root element in Core Properties part. Line 2, position 2.

This does NOT happen when using the nuget command line version 3.2.0.

Here is the full console log:

nuget pack "D:\TFSO\ClassLibraries\Tfso.Core\Core_0_5\Tfso.Core.csproj" -Verbosity detailed -Properties "Configuration=Release;Platform=AnyCPU" -OutputDirectory "C:\yo123"
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. Use option -MSBuild
Version to force nuget to use a specific version of MSBuild.
Attempting to build package from 'Tfso.Core.csproj'.
Packing files from 'D:\TFSO\ClassLibraries\Tfso.Core\Core_0_5\bin\Release'.
Using 'Tfso.Core.nuspec' for metadata.
Add file 'D:\TFSO\ClassLibraries\Tfso.Core\Core_0_5\bin\Release\Tfso.Core.dll' to package as 'lib\net46\Tfso.Core.dll'
System.Xml.XmlException: Unrecognized root element in Core Properties part. Line 2, position 2.
   at MS.Internal.IO.Packaging.PartBasedPackageProperties.ParseCorePropertyPart(PackagePart part)
   at MS.Internal.IO.Packaging.PartBasedPackageProperties.ReadPropertyValuesFromPackage()
   at MS.Internal.IO.Packaging.PartBasedPackageProperties..ctor(Package package)
   at System.IO.Packaging.Package.get_PackageProperties()
   at NuGet.OptimizedZipPackage.<>c__DisplayClassa.<EnsurePackageFiles>b__9(PackagePart part)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at NuGet.OptimizedZipPackage.EnsurePackageFiles()
   at NuGet.OptimizedZipPackage.GetFilesBase()
   at NuGet.LocalPackage.GetFiles()
   at NuGet.PackageExtensions.GetFiles(IPackage package, String directory)
   at NuGet.CommandLine.ProjectFactory.<>c.<AddFiles>b__92_2(IPackage a)
   at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at NuGet.CommandLine.ProjectFactory.AddFiles(PackageBuilder builder, String itemType, String targetFolder)
   at NuGet.CommandLine.ProjectFactory.<>c__DisplayClass56_0.<CreateBuilder>b__1(ProjectFactory p)
   at NuGet.CommandLine.ProjectFactory.ApplyAction(Action`1 action)
   at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath)
   at NuGet.CommandLine.PackCommand.BuildFromProjectFile(String path)
   at NuGet.CommandLine.PackCommand.BuildPackage(String path)
   at NuGet.CommandLine.PackCommand.ExecuteCommand()
   at NuGet.CommandLine.Command.ExecuteCommandAsync()
   at NuGet.CommandLine.Command.Execute()
   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
@teian
Copy link

teian commented Jan 18, 2016

I get the exact same error! This happens only in v3.3.0, 3.2.1.10581 is fine!

@yishaigalatzer
Copy link

Can you please share a full repro?

@yishaigalatzer yishaigalatzer added this to the 3.4 milestone Jan 18, 2016
@yishaigalatzer
Copy link

As we plan to rewrite this part of the pack code, assigning this to @emgarten. A repro will help us build a test making sure this gets resolved for your particular scenario.

@teian
Copy link

teian commented Jan 18, 2016

I would like to help out with a repo since it's internal code from the company I can't promise anytrhing since I have to get approval frist. I will test new versions against this bug though and report back.

@yishaigalatzer
Copy link

@Tak0r the problem is that we don't have a repro for this issue, and we have extensive tests for packing. So it will be a pretty wild goose chase if we can't find a sample that fails.

Are you able to perhaps distill a small example that does not include any proprietary code from your company?

@teian
Copy link

teian commented Jan 18, 2016

I will try to do so tomorrow if I find the time for it.

@yishaigalatzer
Copy link

Thanks!

@Luzenna
Copy link
Author

Luzenna commented Jan 19, 2016

@yishaigalatzer I have uploaded a repo with a project failing to pack.

I was in the same boat as @Tak0r with proprietary code, however I made a stripped down version with all code removed and just a dummy class file added. It still does not pack. I have uploaded that stripped down version to this public repo: https://github.com/Luzenna/nugetbug

Please let me know if you require any more information.

@yishaigalatzer
Copy link

Can you add a readme with exact repro steps?

Sent from my Windows Phone


From: Luzennamailto:[email protected]
Sent: ‎1/‎19/‎2016 12:26 AM
To: NuGet/Homemailto:[email protected]
Cc: Yishai Galatzermailto:[email protected]
Subject: Re: [Home] Nuget Pack throws System.Xml.XmlException: Unrecognized root element in Core Properties part. Line 2, position 2. (#1921)

I was in the same boat as @Tak0rhttps://github.com/Tak0r with proprietary code, however I made a stripped down version with all code removed and just a dummy class file added. It still does not pack. I have uploaded that stripped down version to this public repo: https://github.com/Luzenna/nugetbug

Please let me know if you require any more infomtion.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1921#issuecomment-172773726.

@Luzenna
Copy link
Author

Luzenna commented Jan 20, 2016

@yishaigalatzer
Build the only project in the solution, then try to pack it using nuget command line v.3.3.0.

@yishaigalatzer
Copy link

For the sake of completeness can you type the exact command you are using?

Sent from my Windows Phone


From: Luzennamailto:[email protected]
Sent: ‎1/‎20/‎2016 12:11 AM
To: NuGet/Homemailto:[email protected]
Cc: Yishai Galatzermailto:[email protected]
Subject: Re: [Home] Nuget Pack throws System.Xml.XmlException: Unrecognized root element in Core Properties part. Line 2, position 2. (#1921)

@yishaigalatzerhttps://github.com/yishaigalatzer
Build the only project in the solution, then try to pack it using nuget command line v.3.3.0.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1921#issuecomment-173124443.

@Luzenna
Copy link
Author

Luzenna commented Jan 20, 2016

Well, I did write it in my initial post eight days ago, but here it is again:

nuget pack "D:\TFSO\ClassLibraries\Tfso.Core\Core_0_5\Tfso.Core.csproj" -Verbosity detailed -Properties "Configuration=Release;Platform=AnyCPU" -OutputDirectory "C:\yo123"

@yishaigalatzer
Copy link

Sorry missed that. Thanks for clarifying

@yishaigalatzer
Copy link

OK, Got a repro and looking into it. Note that you accidentally left a link to your appveyor ci feed that of course I cannot connect to. Fortunately taking it off makes the repro work. Can you please take it out for the sake of the developer who is going to try and fix it

@Luzenna
Copy link
Author

Luzenna commented Jan 20, 2016

@yishaigalatzer Sorry 'bout that. Should be OK now.

@yishaigalatzer
Copy link

Thanks!

Looking into it, it seems to be related to a change we indeed made between 3.2.1 and 3.3 (CC @xavierdecoster)

The root cause of the problem is that the package https://www.nuget.org/packages/structuremap/3.1.6.186 is not a compliant OPC package, and hence the OPC package APIs are throwing an exception when trying to traverse the files in it. So this is in a gray area of unintentional breaking change where we used to consume it through different call paths in system.io.packaging that do not expose the issue in this particular package.

I'm going to see if we can come up with a quick solution, longish term (starting work on this shortly) the plan is to completely remove the dependency on system.io.packaging and a manifest definition for the nuspec file, and thus not hitting any such issues in 3.4 (or 3.5 at the latest).

@yishaigalatzer
Copy link

@toddm I suspect this could be another item that got fixed with pack being ported from nuget2 to nuget.client repos

@toddm
Copy link

toddm commented Mar 8, 2016

Yes, this works fine with the latest build: http://myget.org/gallery/nugetbuild. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants