-
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
Report error for native PDB limit #75293
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ namespace Microsoft.Cci | |
internal sealed class PdbWriter : IDisposable | ||
{ | ||
internal const uint Age = 1; | ||
internal const int CustomMetadataByteLimit = 65_504; | ||
|
||
private readonly HashAlgorithmName _hashAlgorithmNameOpt; | ||
private readonly string _fileName; | ||
|
@@ -148,6 +149,15 @@ public void SerializeDebugInfo(IMethodBody methodBody, StandaloneSignatureHandle | |
|
||
if (blob.Length > 0) | ||
{ | ||
if (blob.Length > CustomMetadataByteLimit) | ||
{ | ||
throw new SymUnmanagedWriterException(string.Format( | ||
CodeAnalysisResources.SymWriterMetadataOverLimit, | ||
methodBody.MethodDefinition, | ||
blob.Length, | ||
CustomMetadataByteLimit)); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: the name of the attribute is part of the limit length. Is that included in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the name is not included in the |
||
|
||
_symWriter.DefineCustomMetadata(blob); | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
I'm confused. This test is linked to #75237 but exhibits the same/current behavior described in the issue.
Is this a different scenario than what customers had reported? Should we report a more specific error here (which limit was hit)?
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.
The purpose of these two tests (
_Over
and_Under
) is to verify the exact limit value. To do that, they use a custom writer which intercepts metadata writes and passes a custom buffer with the specified size to the native writer (to see if it fails or not with the buffer). The specific error reporting logic happens before that, so it's not hit. I don't think there's a straightforward way to test that higher-level logic with exact buffer sizes. ButNativeWriterLimit_EndToEnd
tests the specific error (albeit the buffer size cannot be set exactly).