haritha-mohan / MemLeak

command line tool that detects memory leaks via the presence of strongly connected components in an application's heap
https://www.nuget.org/packages/MemLeak
1 stars 0 forks source link

[build] use $(RollForward) Major #4

Closed jonathanpeppers closed 1 year ago

jonathanpeppers commented 1 year ago

Context: https://natemcmaster.com/blog/2019/01/09/netcore-primitives-3/ Context: https://github.com/dotnet/designs/blob/main/accepted/2019/runtime-binding.md#rollforward

I only had .NET 8 installed (no .NET 7) and this app fails to run with:

dotnet run -- analyze -dump=../../20231018_122253_36122.gcdump
You must install or update .NET to run this application.

App: /Users/jopeppers/src/MemLeak/MemLeak/bin/Debug/net7.0/MemLeak
Architecture: arm64
Framework: 'Microsoft.NETCore.App', version '7.0.0' (arm64)
.NET location: /usr/local/share/dotnet

The following frameworks were found:
8.0.0-rc.2.23479.6 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0&arch=arm64&rid=osx-arm64&os=osx.13

To solve this, we need our *.runtimeconfig.json to allow things to automatically roll forward to .NET 8 if .NET 7 is not found.

If we set $(RollForward) to Major:

Major -- Roll forward to lowest higher major version, and lowest minor version, if requested major version is missing. If the requested major version is present, then the Minor policy is used.

I don't think this tool is likely to break on newer .NET versions, and .NET 7 will be used if found.