-
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?
Conversation
50985e8
to
490b67a
Compare
public void NativeWriterLimit_Over(int length) | ||
{ | ||
CompileWithMockedCustomMetadata(length).Diagnostics.Verify( | ||
// error CS0041: Unexpected error writing debug information -- 'Insufficient memory to continue the execution of the program.' |
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. But NativeWriterLimit_EndToEnd
tests the specific error (albeit the buffer size cannot be set exactly).
methodBody.MethodDefinition, | ||
blob.Length, | ||
limit)); | ||
} |
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.
Note: the name of the attribute is part of the limit length. Is that included in the blob
?
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.
No, the name is not included in the blob
. You are right the limit is wrong now, will fix.
@@ -13,5 +13,10 @@ internal static class SymWriterTestUtilities | |||
{ | |||
public static readonly Func<ISymWriterMetadataProvider, SymUnmanagedWriter> ThrowingFactory = | |||
_ => throw new SymUnmanagedWriterException("xxx", new NotSupportedException(), "<lib name>"); | |||
|
|||
public static SymUnmanagedWriter CreateUnmanagedWriter(ISymWriterMetadataProvider metadataProvider) |
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.
What's the benefit of this factory method vs. using SymUnmanagedWriterFactory.CreateWriter
directly?
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.
SymUnmanagedWriterFactory when used from PDBTests raises a compile-time error because the type is defined both in Microsoft.DiaSymReader and Microsoft.CodeAnalysis assemblies. This utility project only references Microsoft.CodeAnalysis, so this factory method is a simple way to work around that problem (without the need for extern aliases).
|
||
namespace Roslyn.Test.PdbUtilities; | ||
|
||
internal sealed class CustomMetadataSymUnmanagedWriter(SymUnmanagedWriter target, byte[] customMetadata) : DelegatingSymUnmanagedWriter(target) |
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.
I think it needs to be in this separate utility assembly, because in PDBTests some of the types would conflict between Microsoft.DiaSymReader and Microsoft.CodeAnalysis which are both referenced from there
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.
Done with review pass (iteration 1). Only minor questions
Resolves #75237.