question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SingleFile Bundling should deduplicate path conflicts

See original GitHub issue

Description

A recent package update to a third party library broke a project we have that compiled to a single file executable. The error message was the dreaded Error MSB4018: The "GenerateBundle" task failed unexpectedly , Found multiple entries with the same BundleRelativePath error.

Using the nice features released in net6 preview I was able to narrow the file collision down to these two entries - the xml file that’s part of the FSharp.Core library. Frustratingly in this case, an upstream problem causes the FSharp.Core.dll library to be included twice and as of release 5.0.1 for that library, they added an xml file that is now copied twice into the final binary. It doesn’t affect multi file distributions - presumably just copes over, but for single file it stops with this error (as of net6) and a more cryptic error without the paths in net5 and earlier.

System.ArgumentException: Invalid input specification: Found entries 
'C:\xxxxx\.nuget\packages\fsharp.core\5.0.1\contentFiles\any\netstandard2.0\FSharp.Core.xml', 
'C:\xxxxx\.nuget\packages\fsharp.core\5.0.1\contentFiles\any\netstandard2.0\FSharp.Core.xml' with the same BundleRelativePath 'FSharp.Core.xml

I have a attached a tiny project below that reproduces the setup. The duplication comes from one project referring to another (both F#) projects, and using the paket package manager which manages the msbuild instructions. I honestly can’t tell why there are two copies but it’s non-trivial to prevent unfortunately, so it’s not an option to reconfigure the project (I tried for many hours).

I would expect the bundler to deduplicate the source /target paths like the one above and conclude there is no collision. Obviously attempting to bundle two different libraries into the same output file would be bad but this is not the case.

Configuration

  • "5.0.200 (also happens on all later net6 versions up to nightly release)
  • Windows
  • x64
  • Appears to be a general issue with the platform
  • F# application (for what it’s worth)

Regression?

In this case, it is not a net runtime issue that caused the problem but a library change. Unfortunately this scenario is common enough to be a major headache. Others had reported the same problem with the triggering library by the time I diagnosed the root cause. Short term the library can be altered but it would be strongly preferable for the bundler to simply dedup the list before deciding if there are collisions

Other information

Same reproduction.

Playground.zip

[FSharp library causing the issue]((https://github.com/dotnet/fsharp/issues/11111)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
vitek-karascommented, Mar 11, 2021

I would very much prefer for SDK to deduplicate this before it gets to single-file. There are potentially other problems if the file is listed twice. We might run crossgen on it twice (if crossgen is enabled), we might pass it to trimmer twice (which is probably OK, but still) and so on.

0reactions
sfoslundcommented, Apr 12, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite deduplication causing problems with non-deterministic ...
Describe the bug Vite (thankfully) deduplicates byte-to-byte equal asset files. In my project I create the assets dynamically with a custom ...
Read more >
Finding and fixing duplicates in webpack with Inspectpack
Needlessly duplicated dependencies produce larger, slower web applications. Let's embark on a deep dive into how npm and webpack work, ...
Read more >
SingleFile: Save a complete web page into a single HTML file
I'm going to hijack your post for a question! I love the way you can use the editor and select "format for better...
Read more >
C# A proper and simple way to bundle multiple small files ...
I am trying to figure out how to store data that can be easily/heavily edited. Reading data from a big single file isn't...
Read more >
SplitChunksPlugin
Webpack will automatically split chunks based on these conditions: ... When files paths are processed by webpack, they always contain / on Unix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found