Closed bradwilson closed 11 months ago
For the moment I've worked around the issue by copying all the to-be-merged files into a new premerge
folder so that there's no .config
files hanging around to trip the issue: https://github.com/xunit/xunit/blob/ea3007119bff2358873ac6fe0d922a60c5090f82/src/Directory.Build.targets#L11-L56
Will still appreciate a fix, though, so I can stop the unnecessary file copying.
This issue is really quite frustrating. I encountered that before.
Maybe it is possible to add an option to merge the config file or not. This is not so difficult to implement.
Thanks @wmjordan for submitting the PR #291, the latest version has this option now: /skipconfig
Leaving the issue open to debug the underlying problem.
Also the logic to merge config files was rewritten using XLinq, so it's likely it has been fixed accidentally, worth a check. Might not even need the /skipconfig now.
Try https://www.nuget.org/packages/ILRepack/2.0.21, with and without /skipconfig
I just installed 2.0.21 and tried it on one of my production project, which was well merged by 2.0.15 before. I got the following exception:
System.Runtime.Serialization.SerializationException: Deserializing object failed. ---> System.Xml.XmlException: Invalid data on root element, line 1, position 1. at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3) at System.Xml.XmlUTF8TextReader.Read() at System.Xml.XmlBaseReader.IsStartElement() at System.Xml.XmlBaseReader.IsStartElement(XmlDictionaryString localName, XmlDictionaryString namespaceUri) at System.Runtime.Serialization.XmlObjectSerializer.IsRootElement(XmlReaderDelegator reader, DataContract contract, XmlDictionaryString name, XmlDictionaryString ns) at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader) at ILRepacking.Steps.ResourcesRepackStep.GetRepackListFromStream(Stream stream) at ILRepacking.Steps.ResourcesRepackStep.Perform() at ILRepacking.ILRepack.Repack() at ILRepacking.Application.Main(String[] args)
For my side, I can verify that the merge failure is gone now, using 2.0.21. I have been able to remove my premerge steps, and I verified that the only difference between the .config
file in the unmerged folder and the .config
file in the merged folder is that the merged version (benignly) added a UTF-8 BOM.
Change set (on top of the existing 2.0.21 upgrade in the commit prior): https://github.com/xunit/xunit/commit/920e3e521904741ffd2c1c100ef2073bbfa45cf5
@wmjordan thanks for trying it out!
I found the regression and fixed in https://github.com/gluck/il-repack/commit/01b54ff113123da84d8283df0b70175549e926b0
Will publish a new release soon, need to do some testing and fix a couple unrelated bugs.
I've now published https://www.nuget.org/packages/ILRepack/2.0.22
@wmjordan if you could try it out whenever you get a chance
@bradwilson you should now be able to call dotnet ILRepack.exe
instead of mono ILRepack.exe
on Unix, hopefully it'll work with both runtimes.
I'll be closing this issue but please feel free to file new bugs if something else is wrong.
Hi, I downloaded the new version, used it on the previously reported project and it was working very well now.
Verified it works here as well. Thanks!
When trying to run ILRepack against a .NET Framework application on Linux, I get an error which says that it failed to merge configuration files.
Repro:
git checkout 9195c0b
(this is on an in-progress branch, so I'm sending you to a moment in time)dotnet build src/xunit.v3.runner.console
Working on Windows:
Broken on Linux:
Our CI process uses the Linux build for making the official builds.
It does appear to be successfully running the repack, because it generates an executable which appears to run okay:
I'm not sure what it's trying to do with the configuration file(s), but on the successful Windows side, the resulting "merged"
.exe.config
file is identical to original.exe.config
file, except that the XML declaration has hadencoding="utf-8"
removed (why?) andstandalone="yes"
added (understandable). I would be happy to run ILRepack in such a way as to bypass .config file handling, since it would be just as easy for me to copy the original.exe.config
file into themerged
folder, but I didn't see any command line switch that would turn off config file processing.I am invoking ILRepack via the executable:
dotnet --info
on Windows:dotnet --info
on Linux: