dotnet / dotnet/macios

Make bgen resilient to .NET versions

Open
#26,584 1 comment 0 reactions 0 assignees View on GitHub
generator
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 17h
Merged PRs (30d)
108

Description

This has happened multiple times:

1. We get a maestro bump for a preview/rc version of .NET, close to the end up that preview/rc's release date.
2. The actual preview/rc's final version is *lower* than the one we bumped to.

This means the workloads we shipped were built with a newer version of .NET than the one that was released.

This is a problem for bgen, because bgen embeds the .NET version it was built against in its bgen.runtimeconfig.json:

```json
{
"runtimeOptions": {
"tfm": "net11.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "11.0.0-rc.1.26426.105"
},
"rollForward": "Major",
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}%
```

This is for .NET 11 RC 1 - we built with "11.0.0-rc.1.26426.105", and the version that was shipped was "11.0.0-rc.1.26425.128".

The result is that running `bgen` fails (which means all binding projects fail to build):

```
$ /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net11.0_26.5/26.5.12193-net11-rc.1/tools/bin/bgen
You must install or update .NET to run this application.

App: /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net11.0_26.5/26.5.12193-net11-rc.1/tools/lib/bgen/bgen.dll
Architecture: arm64
Framework: 'Microsoft.NETCore.App', version '11.0.0-rc.1.26426.105' (arm64)
.NET location: /usr/local/share/dotnet/

The following frameworks were found:
10.0.10 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
11.0.0-rc.1.26425.128 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=11.0.0-rc.1.26426.105&arch=arm64&rid=osx-arm64&os=osx
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating bgen.runtimeconfig.json and the bgen packaging or build entry point that produces it. Reproduce the failure with the mismatched .NET RC versions shown in the report, then verify that bgen runs and binding projects build when the shipped runtime version is lower than the version used to build bgen.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.