Closed Deadpikle closed 9 months ago
Hello,
First of all, Env flag is not needed in your code above. To fix the odd behavior, try this:
SlnItems.SolutionConfPlatforms | SlnItems.ProjectConfPlatforms
However,
The real problem is a little deeper if you really need to use SlnItems.Env because MvsSln v2 (#23) partially relies on GlobalProjectCollection (msbuild) which can cause problems like yours (depends on environment).
That's why in the past MvsSln v2.4 introduced XProjectEnv in addition to IsolatedEnv, see #17
In other words,
Modern MvsSln provides two implementation of IXProjectEnv (IsolatedEnv is the default if raised SlnItems.Env). And if your environment also relies on GlobalProjectCollection, you need to consider to implement you custom disposing if needed at all.
Here you can find an example of applied custom disposing between two completely different environments Visual Studio as a VSIX plugin and MSBuild for CI https://github.com/3F/vsSolutionBuildEvent/pull/53
First of all, Env flag is not needed in your code above. To fix the odd behavior, try this:
This fixed the problem up real quick. Thank you for your reply and the additional info on how to fix things should I need SlnItems.Env
in the future.
Appreciate it — and your library! 😄
Hi,
I'm experiencing a weird error that only happens when I publish my app as a single file. It seems to happen on deconstruction, which is odd. My goal is to load a list of solution configs and solution projects so that the user can choose an appropriate pair (config & project).
Here's the stack trace:
Here's the code in MyApp that the stack trace points to:
SolutionConfigPlatforms
is a simple model defined as:SLN:
Note that this code runs on a background thread.
I haven't yet done the dirty work of trying to create a small minimal sample due to running out of time now, but am posting this in hopes that someone may know the answer or what to look at sooner than I will have time to dig in deeper. The issue seems to be deeper in MS-provided code, but am not sure if something is being utilized wrong.
Environment: macOS 12.6.9 .NET Version: .NET 8 RC 1 (this did seem to happen on .NET 7, too)
Build command: dotnet publish "/Users/[name]/Documents/Projects/[Name].csproj" --configuration "Release" --framework "net8.0" --runtime "osx-x64" /p:PublishSingleFile=true --self-contained True
Any help is appreciated!
Thanks~