-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
-p:DebugSymbols=false does not disable generation of .pdb files #41364
Comments
MSBuild owns DebugSymbols; would you mind taking a first look? |
The compiler is passed both
and produces this part of the command line
The ❯ &"C:\Program Files\dotnet\dotnet.exe" exec "C:\Program Files\dotnet\sdk\8.0.300\Roslyn\bincore\csc.dll" /noconfig `@foo.rsp
Microsoft (R) Visual C# Compiler version 4.10.0-3.24216.12 (3af0081a)
Copyright (C) Microsoft Corporation. All rights reserved.
error CS2045: /embed switch is only supported when emitting a PDB. @jaredpar would you say we should treat this as a |
The compilers have long allowed for contradictory params to be provided. There are ample tests in the native and Roslyn compiler to ensure we handle contradictory parameters correctly. Not my preferred design but it's very much baked into how the compiler operates.
Unless stated otherwise the last switch wins. |
At the compiler CLI layer I think that's fine and wouldn't want to change at this point, but at the task layer there's no user control over order so they're at the mercy of what the task chooses. (I lean toward "this is an SDK bug" personally) |
Yeah if we want universal behavior for all the languages then feels like something that should be handled at the SDK layer. Basically normalize out the properties so that all the compilers don't have to individually do this work. |
Ah, I'd assumed we were just passing information to MSBuild, and it was getting mangled either there or at the compiler. It sounds like the problem is that we look for a particular property and pass a default value if it isn't present but won't notice an alternate way of expressing a similar concept. Does that sound right? If so, I think I'd agree that this is probably best resolved in the SDK layer by not expressing that. Looking around, this seems by far the most likely culprit:
I can change that to set DebugType to None if DebugSymbols is set to false if that sounds reasonable to you. |
Fixes #41364 DebugSymbols=false is a parameter that ultimately gets passed to the compiler, disabling pdb generation. There's also DebugType, which, when set to None, is supposed to disable generating pdbs. When DebugSymbols is set but not DebugType, the SDK sees DebugType as not set and sets it to portable, leading to pdb generation even though DebugSymbols was set to false. This is unexpected, so this makes DebugType automatically None when DebugSymbols was false.
Describe the bug
https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022 states:
This does not match .NET 8 SDK behavior.
-p:DebugType=None
is the actual property that can be used to disable the .pdb symbol generation.DebugSymbols property should be either documented as obsolete and no longer supported with DebugType as recommended replacement; or the behavior DebugSymbols property should be fixed to match the documentation.
To Reproduce
Actual result: .pdb file is generated
Expected result: No .pdb file is generated
Further technical details
.NET SDK 8.0.205
The text was updated successfully, but these errors were encountered: