Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New MEDIASUBTYPE_ guid constants are faulty #1207

Closed
AArnott opened this issue Sep 1, 2022 · 1 comment
Closed

New MEDIASUBTYPE_ guid constants are faulty #1207

AArnott opened this issue Sep 1, 2022 · 1 comment
Labels
blocking A projection cannot use the latest version bug Something isn't working

Comments

@AArnott
Copy link
Member

AArnott commented Sep 1, 2022

In updating CsWin32 to the latest metadata (29.0.6), we hit a snag that blocks adoption. Some new guid constants are included in the metadata that are causing us trouble:

  Message: 
Microsoft.Windows.CsWin32.GenerationFailedException : Failed creating field: Windows.Win32.Media.MediaFoundation.Apis.MEDIASUBTYPE_P208
---- System.BadImageFormatException : Read out of bounds.

  Stack Trace: 
Generator.DeclareConstant(FieldDefinition fieldDef) line 3192
<>c__DisplayClass165_0.<RequestConstant>b__0() line 1494
GeneratedCode.GenerateConstant(FieldDefinitionHandle fieldDefinitionHandle, Action generator) line 6090
Generator.RequestConstant(FieldDefinitionHandle fieldDefHandle) line 1491
<>c__DisplayClass137_0.<GenerateAllConstants>b__1() line 756
GeneratedCode.GenerationTransaction(Action generator) line 5988
Generator.GenerateAllConstants(CancellationToken cancellationToken) line 754
Generator.GenerateAll(CancellationToken cancellationToken) line 573
GeneratorTests.FullGeneration(MarshalingOptions marshaling, Boolean useIntPtrForComOutPtr, Platform platform) line 1549
----- Inner Stack Trace -----
Throw.OutOfBounds()
CustomAttributeDecoder`1.DecodeArgument(BlobReader& valueReader, ArgumentTypeInfo info)
CustomAttributeDecoder`1.DecodeFixedArguments(BlobReader& signatureReader, BlobReader& valueReader, Int32 count)
CustomAttributeDecoder`1.DecodeValue(EntityHandle constructor, BlobHandle value)
CustomAttribute.DecodeValue[TType](ICustomAttributeTypeProvider`1 provider)
Generator.GuidValue(CustomAttribute guidAttribute) line 2335
Generator.DeclareConstant(FieldDefinition fieldDef) line 3135

Looking at the metadata, I see the constant is defined like this:

.field public static valuetype [netstandard]System.Guid MEDIASUBTYPE_P208
.custom instance void [Windows.Win32.Interop]Windows.Win32.Interop.GuidAttribute::.ctor(uint32, uint16, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8) = (
	01 00 00 00 10 00 80 00 00 aa 00 38 9b 71 00 00
)

But this is inconsistent with other Guid constants that do work, like this one:

.field public static valuetype [netstandard]System.Guid WIA_CATEGORY_FINISHED_FILE
.custom instance void [Windows.Win32.Interop]Windows.Win32.Interop.GuidAttribute::.ctor(uint32, uint16, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8) = (
	01 00 ca 77 2b ff 84 cf 2b 43 a7 35 3a 13 0d de
	2a 88 00 00
)

Note how there are 4 bytes missing from the broken guid constant.

@AArnott AArnott added bug Something isn't working blocking A projection cannot use the latest version labels Sep 1, 2022
@AArnott
Copy link
Member Author

AArnott commented Sep 1, 2022

Duplicate of #1116

@AArnott AArnott marked this as a duplicate of #1116 Sep 1, 2022
@AArnott AArnott closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2022
AArnott added a commit to microsoft/CsWin32 that referenced this issue Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocking A projection cannot use the latest version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant