Repository navigation
Conversation
Fixes Fallout-build#710 When targeting `net11.0` or running on .NET 11, Fallout projects crashed on startup with: > System.TypeInitializationException: The type initializer for 'Fallout.Common.FalloutBuild' threw an exception. > ---> System.ArgumentException: Expected condition to be true (Parameter 'assemblyLocation == string.Empty || assemblyLocation == invokedLocation') Testing .NET 11 RC1 and RC2 on macOS and Windows, the clause `assemblyLocation == invokedLocation` no longer holds. On macOS: - assemblyLocation = "Fallout/build/bin/Debug/_build.dll" - invokedLocation = "Fallout/build/bin/Debug/_build" On Windows: - assemblyLocation = "Fallout\build\bin\Debug\_build.dll" - invokedLocation = "Fallout\build\bin\Debug\_build.exe" Update the assertion to canonicalize extensions to `.dll` before comparing.
ChrisonSimtian
left a comment
There was a problem hiding this comment.
can we please come up with some unit tests / specs for this as well?
|
I am not sure this can be unit tested. The problem I see is that the Fallout/src/Fallout.Build/FalloutBuild.Statics.cs Lines 17 to 22 in fcf5cbb Which means that, as soon as any member (static or instance) of FalloutBuild is accessed, the static constructor kicks in, calls But since reproducing this requires either targeting Would you be able to help with, for instance:
I think doing something like that should reproduce the issue as reported in #710 without this change, and confirm the fix with it. I don't think I can add such a test but I would appreciate it if a maintainer would be willing to try it. |
|
Perhaps the better fix would be to simply remove this assertion: It worked up to and including .NET 10, but stops working as of .NET 11. It is now, and will likely continue to be, very impactful because it failing throws from the static constructor, making the Removing the assertion would at least give builds a chance of starting on .NET 11 and later. I can update the PR if you prefer this instead. |
|
Or you add some sort of a env var switch.. default behavior matches this behavior right now. If you know what you are doing, turn this assertion off. like: |
|
I'll defer to the maintainers to decide, but I don't think adding an env var or any configurable knob is needed. In my testing, builds worked once this assertion was removed or fixed to pass. Thus I see it as a matter of deciding whether the assertion is worth keeping; I'm not sure what value it provides, or what it is supposed to guard against. The downside of it failing, bringing everything down with it if/when that happens, seems disproportionate to any utility it might have had once. |
Fixes #710
When targeting
net11.0or running on .NET 11 (e.g. viaRollForward=Major), Fallout projects crash on startup with:Testing .NET 11 RC1 and RC2 on macOS and Windows, the clause
assemblyLocation == invokedLocationno longer holds.On macOS:
On Windows:
Update the assertion to canonicalize extensions to
.dllbefore comparing.