Fix CI Build Error: IsExternalInit in FluentMigrator.Analyzers
This PR fixes the CI build failure caused by missingSystem.Runtime.CompilerServices.IsExternalInit type when using init-only properties in a netstandard2.0 project.
Problem
The FluentMigrator.Analyzers project targets netstandard2.0 but uses C# 9 init-only properties inMigrationClassDeclaration.cs. The compiler requires theIsExternalInit type to support these properties, but this type is not available in netstandard2.0, causing the build to fail with error CS0518.
Solution
Added a minimalIsExternalInit.cs stub file to the FluentMigrator.Analyzers project that provides the required type. This is a standard polyfill approach for using init-only properties in older target frameworks.
Changes
References
Original prompt
Problem: The CI build for fluentmigrator is failing with errors in FluentMigrator.Analyzers: "Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported". The failure occurs because MigrationClassDeclaration.cs uses init-only properties (C# 9 feature) while the analyzers project targets netstandard2.0, which doesn't provide IsExternalInit.
Goal: Add a minimal IsExternalInit type stub to the FluentMigrator.Analyzers project so the project can compile under netstandard2.0 and CI passes. Create a branch, commit the new file, and open a pull request against the repository's default branch.
Files to add/change:
- Add src/FluentMigrator.Analyzers/IsExternalInit.cs with the following content:
namespace System.Runtime.CompilerServices
{
// Provides the missing IsExternalInit type required for C# init-only properties when building against older target frameworks.
// This type is intentionally minimal; it only exists to satisfy the compiler.
internal static class IsExternalInit { }
}
Notes:
- This file should be small and have no dependencies. No changes to the existing csproj are required because the SDK will pick up the new .cs file automatically.
- The commit message should be: "Add IsExternalInit stub to FluentMigrator.Analyzers to support init-only properties on netstandard2.0"
- The PR title should match the problem_title above and include a short description referencing the failing job: "Fixes CI build error CS0518 (IsExternalInit) in FluentMigrator.Analyzers" and link to the failing job:https://github.com/fluentmigrator/fluentmigrator/actions/runs/19479023456/job/55746412336?pr=2177
Please create the branch, add the file, commit, and open the PR. Do not assign reviewers or merge the PR.
This pull request was created as a result of the following prompt from Copilot chat.
Problem: The CI build for fluentmigrator is failing with errors in FluentMigrator.Analyzers: "Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported". The failure occurs because MigrationClassDeclaration.cs uses init-only properties (C# 9 feature) while the analyzers project targets netstandard2.0, which doesn't provide IsExternalInit.
Goal: Add a minimal IsExternalInit type stub to the FluentMigrator.Analyzers project so the project can compile under netstandard2.0 and CI passes. Create a branch, commit the new file, and open a pull request against the repository's default branch.
Files to add/change:
- Add src/FluentMigrator.Analyzers/IsExternalInit.cs with the following content:
namespace System.Runtime.CompilerServices
{
// Provides the missing IsExternalInit type required for C# init-only properties when building against older target frameworks.
// This type is intentionally minimal; it only exists to satisfy the compiler.
internal static class IsExternalInit { }
}
Notes:
- This file should be small and have no dependencies. No changes to the existing csproj are required because the SDK will pick up the new .cs file automatically.
- The commit message should be: "Add IsExternalInit stub to FluentMigrator.Analyzers to support init-only properties on netstandard2.0"
- The PR title should match the problem_title above and include a short description referencing the failing job: "Fixes CI build error CS0518 (IsExternalInit) in FluentMigrator.Analyzers" and link to the failing job:https://github.com/fluentmigrator/fluentmigrator/actions/runs/19479023456/job/55746412336?pr=2177
Please create the branch, add the file, commit, and open the PR. Do not assign reviewers or merge the PR.
✨ Let Copilot coding agentset things up for you — coding agent works faster and does higher quality work when set up for your repo.
Uh oh!
There was an error while loading.Please reload this page.
Fix CI Build Error: IsExternalInit in FluentMigrator.Analyzers
This PR fixes the CI build failure caused by missing
System.Runtime.CompilerServices.IsExternalInittype when using init-only properties in a netstandard2.0 project.Problem
The FluentMigrator.Analyzers project targets netstandard2.0 but uses C# 9 init-only properties in
MigrationClassDeclaration.cs. The compiler requires theIsExternalInittype to support these properties, but this type is not available in netstandard2.0, causing the build to fail with error CS0518.Solution
Added a minimal
IsExternalInit.csstub file to the FluentMigrator.Analyzers project that provides the required type. This is a standard polyfill approach for using init-only properties in older target frameworks.Changes
#if NETSTANDARD2_0conditional compilation directiveReferences
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agentset things up for you — coding agent works faster and does higher quality work when set up for your repo.