GenAPI does not correctly handle System.Runtime
See original GitHub issueSteps to Reproduce utilizing https://github.com/dotnet/source-build-reference-packages/blob/main/generate.sh
- ./generate -x -p System.Runtime,4.3.1 (also get the same results with 4.1.0 and 4.3.0)
- ./build -sb
Issues with generated code:
- const readonly - Generated code has
const readonly
which is not valid and causes compilation errors.
public partial struct Decimal : IComparable, IComparable<Decimal>, IConvertible, IEquatable<Decimal>, IFormattable
{
public const readonly Decimal MaxValue = MaxValue;
public const readonly Decimal MinusOne = -1M;
public const readonly Decimal MinValue = MinValue;
public const readonly Decimal One = 1M;
public const readonly Decimal Zero = 0M;
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1065,22): error CS1001: Identifier expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1065,22): error CS0145: A const field requires a value to be provided [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1065,22): error CS1002: ; expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1066,22): error CS1031: Type expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1066,22): error CS1001: Identifier expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1066,22): error CS0145: A const field requires a value to be provided [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1066,22): error CS1002: ; expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1067,22): error CS1031: Type expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1067,22): error CS1001: Identifier expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1067,22): error CS0145: A const field requires a value to be provided [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1067,22): error CS1002: ; expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1068,22): error CS1031: Type expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1068,22): error CS1001: Identifier expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1068,22): error CS0145: A const field requires a value to be provided [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.3/System.Runtime.cs(1068,22): error CS1002: ; expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.3] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.5/System.Runtime.cs(1071,22): error CS1002: ; expected [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.5] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
Workaround: Replace const readonly
with const
- Missing attribute types - See https://github.com/dotnet/sdk/issues/33388
Workaround: Manually add missing attribute types.
- Circular Reference: primitive type constants have circular references.
public partial struct UInt32 : IComparable, IComparable<UInt32>, IEquatable<UInt32>, IFormattable
{
public const UInt32 MaxValue = MaxValue;
/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/ref/netstandard1.0/System.Runtime.cs(2775,29): error CS0110: The evaluation of the constant value for 'uint.MaxValue' involves a circular definition [/repos/source-build-reference-packages/artifacts/source-build/self/src/src/referencePackages/src/system.runtime/4.3.1/System.Runtime.4.3.1.csproj::TargetFramework=netstandard1.0] [/root/.nuget/packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23371.1/tools/Build.proj]
Workaround: Manually update code to use numeric values.
Issue Analytics
- State:
- Created 2 months ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Could not load file or assembly 'System.Runtime, Version= ...
10 Answers 10 · Go to your project folder. · Delete the bin file inside your project folder. · Remove all added references....
Read more >GenICam GenTL Standard
GenApi is only a reference implementation, not a mandatory standard. User ... System module handle is requested twice from within a single ...
Read more >Image Acquisition Interface for GenICam GenTL compliant ...
Please note that it might not be possible to use different GenApi versions ... GenICam-based parameters of the individual GenTL Producer modules (system, ......
Read more >Common Vision Blox: Common Vision Blox - Online help for ...
GenApi.NODE and Cvb.GenApi.NODEMAP it was necessary to change the signature of those two call-backs to accept System.IntPtr parameters instead of Cvb.GenApi.
Read more >pylon SDK Samples Manual
This topic describes the SDK sample programs delivered with the pylon Camera Software Suite.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Roslyn change merged - that should fix the two unique issues reported here. Plan to resolve this once we can pick up a new roslyn build. Leave the linked issue open to track attribute handling.
Both 1 and 3 are roslyn issues.
1 is due to
decimal
constants being represented differently in metadata. They are a readonly field with an attribute that provides the value. As a result it causes this issue: https://github.com/dotnet/roslyn/issues/69376 I haven’t yet found a good workaround for this - but it should be possible.3 is due to a bug in how SyntaxGenerator emits literal values. It tries to map to some well known constants, but doesn’t account for that fact it might be defining those constants. https://github.com/dotnet/roslyn/issues/69380 For this I have a workaround.