-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Require SizeConst
for UnmanagedType.ByValArray
#68992
Conversation
…o require it when decoding instead of defaulting to length 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot be an error
@jaredpar @AlekseyTs can I get another review pass? |
@@ -209,6 +209,7 @@ internal static int GetWarningLevel(ErrorCode code) | |||
switch (code) | |||
{ | |||
case ErrorCode.WRN_AddressOfInAsync: | |||
case ErrorCode.WRN_ByValArraySizeConstRequired: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Compilers/Core/Portable/Symbols/Attributes/MarshalAsAttributeDecoder.cs
Outdated
Show resolved
Hide resolved
Instead of modifying attributes in this test, we should assert the warnings. Otherwise we are not verifying metadata emitted for the affected scenario. In reply to: 1644180537 Refers to: src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_MarshalAs.cs:565 in 60d535c. [](commit_id = 60d535c, deletion_comment = False) |
Also should test that the warning is suppressed if In reply to: 1644180537 Refers to: src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_MarshalAs.cs:565 in 60d535c. [](commit_id = 60d535c, deletion_comment = False) |
We should check if any diagnostic is reported for similar VB test. In reply to: 1644195564 Refers to: src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_MarshalAs.cs:565 in 60d535c. [](commit_id = 60d535c, deletion_comment = False) |
Done with review pass (commit 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 12)
@dotnet/roslyn-compiler For the second review |
@jkoritzinsky can you get the merge conflicts fixed and then we should be good to merge. |
MarshalAsAttribute.SizeConst
is required by all runtimes forUnmanagedType.ByValArray
, so warn when it is not provided.As mentioned below, we cannot make it an error due to back-compat.
Fixes #68988
Fixes dotnet/runtime#36134