Skip to content

Commit eac6966

Browse files
authored
Merge pull request #20 from wlsnmrk/doc/compiler-version-error
doc: recommend treating CS9057 as error
2 parents a341d2d + 4ab0a0b commit eac6966

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
"omnisharp.enableEditorConfigSupport": true,
146146
"omnisharp.enableMsBuildLoadProjectsOnDemand": false,
147147
"omnisharp.maxFindSymbolsItems": 3000,
148-
"omnisharp.organizeImportsOnFormat": true,
149148
"omnisharp.useModernNet": true,
150149
// Remove these if you're happy with your terminal profiles.
151150
"terminal.integrated.defaultProfile.windows": "Git Bash",
@@ -165,5 +164,6 @@
165164
"icon": "terminal-powershell",
166165
"source": "PowerShell"
167166
}
168-
}
167+
},
168+
"dotnet.formatting.organizeImportsOnFormat": true
169169
}

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,24 @@ Create mixins and generate metadata about types at build time to enable reflecti
1414

1515
Find the latest version of the [Introspection] and [Introspection Generator] packages from nuget and add them to your C# project.
1616

17+
> [!WARNING]
18+
> Introspection is compiled against the latest .NET 8 SDK. Because .NET 8 encompasses multiple versions of the [.NET compiler], compiling your project against an older version of .NET 8 may generate a `CS9057` warning to indicate a compiler-version mismatch. However, if the warning is ignored, less-tractable downstream compilation errors, or even runtime errors, may result. Therefore, we strongly recommend treating `CS9057` as an error to catch compiler versioning issues at the earliest opportunity.
19+
1720
```xml
18-
<PackageReference Include="Chickensoft.Introspection" Version=... />
19-
<PackageReference Include="Chickensoft.Introspection.Generator" Version=... PrivateAssets="all" OutputItemType="analyzer" />
21+
<Project Sdk=...>
22+
<PropertyGroup>
23+
<TargetFramework>net8.0</TargetFramework>
24+
...
25+
<!-- Catch compiler-mismatch issues -->
26+
<WarningsAsErrors>CS9057</WarningsAsErrors>
27+
...
28+
</PropertyGroup>
29+
30+
<ItemGroup>
31+
<PackageReference Include="Chickensoft.Introspection" Version=... />
32+
<PackageReference Include="Chickensoft.Introspection.Generator" Version=... PrivateAssets="all" OutputItemType="analyzer" />
33+
</ItemGroup>
34+
</Project>
2035
```
2136

2237
## 📙 Background
@@ -83,7 +98,7 @@ The type graph can be used to query information about types at runtime. If the t
8398

8499
```csharp
85100

86-
// Get every type that is a valid subtype of Ancestor.
101+
// Get every type that is a valid subtype of Ancestor.
87102
var allSubtypes = Types.Graph.GetDescendantSubtypes(typeof(Ancestor));
88103

89104
// Only get the types that directly inherit from Parent.
@@ -274,3 +289,4 @@ public partial class MyModel {
274289
[instance state]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods#detailed-design
275290
[blackboard]: https://github.com/chickensoft-games/Collections?tab=readme-ov-file#blackboard
276291
[metatype]: Chickensoft.Introspection/src/types/IMetatype.cs
292+
[.NET compiler]: https://github.com/dotnet/roslyn/blob/main/docs/wiki/NuGet-packages.md

0 commit comments

Comments
 (0)