Skip to content

Conversation

@marcin-krystianc
Copy link
Contributor

@marcin-krystianc marcin-krystianc commented Aug 29, 2022

With ..NET 7 (RC and preview versions) it is not possible to dump the single aggregated project file with (the /pp command) for F# projects. The problem is in the XML comment because it starts with the - character:

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.ArgumentException: An XML comment cannot contain '--', and '-' cannot be the last character.
   at System.Xml.XmlTextWriter.WriteComment(String text)
   at System.Xml.XmlElement.WriteElementTo(XmlWriter writer, XmlElement el)
   at System.Xml.XmlDocument.Save(XmlWriter w)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.SaveLogicalProject(TextWriter writer)
   at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, Dictionary`2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, TextWriter targetsWriter, Boolean detailedSummary, ISet`1 warningsAsErrors, ISet`1 warningsNotAsErrors, ISet`1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, GraphBuildOptions graphBuildOptions, Boolean lowPriority, String[] inputResultsCaches, String outputResultsCache, String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
Unhandled exception: System.ArgumentException: An XML comment cannot contain '--', and '-' cannot be the last character.
   at System.Xml.XmlTextWriter.WriteComment(String text)
   at System.Xml.XmlElement.WriteElementTo(XmlWriter writer, XmlElement el)
   at System.Xml.XmlDocument.Save(XmlWriter w)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.SaveLogicalProject(TextWriter writer)
   at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, Dictionary`2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, TextWriter targetsWriter, Boolean detailedSummary, ISet`1 warningsAsErrors, ISet`1 warningsNotAsErrors, ISet`1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, GraphBuildOptions graphBuildOptions, Boolean lowPriority, String[] inputResultsCaches, String outputResultsCache, String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
   at Microsoft.DotNet.Cli.Utils.MSBuildForwardingAppWithoutLogging.ExecuteInProc(String[] arguments)

How to reproduce & test the fix

dotnet msbuild /t:build /pp MyProj.fsproj

@marcin-krystianc
Copy link
Contributor Author

FWIW, I think it is a mistake in this PR, it checks now beginning of the XML comment, instead of the end.

@vzarytovskii vzarytovskii enabled auto-merge (squash) August 29, 2022 12:28
@marcin-krystianc
Copy link
Contributor Author

FYI: I've reported it - dotnet/runtime#74752

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants