Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

Visual Studio 디버깅 경고 창 - You are debugging a Release build of ...

Visual Studio로 디버깅 중 특정 DLL에 대해 다음과 같은 경고 창이 뜹니다.

dbg_stop_continue_dlg_1.png

You are debugging a Release build of ....dll. Using Just My Code with Release builds using compiler optimizations results in a degraded debugging experience (e.g. breakpoints will not be hit).


로딩된 DLL이 정말 디버그 모드로 빌드가 안된 것인지 우선 확인이 필요한데요. 이를 위해 "Ctrl + Alt + U"를 눌러 Modules 창을 띄우면 다음과 같이 문제가 되는 DLL의 정확한 위치를 알 수 있습니다.

Test.Deployment.dll C:\Users\...\AppData\Local\Temp\Temporary ASP.NET Files\root\e340c117\16ede91d\assembly\dl3\4f9f32bc\3dfbd40c_939fd201\Test.Deployment.dll

그런데... Modules 창에는 분명히 "Symbols loaded."라는 메시지와 함께 "C:\...\Test.Deployment.pdb" 파일이 선택되었다고 합니다. 즉, 디버거를 위한 PDB 파일은 정상적으로 제공된 상태입니다.

다음 단계로, 해당 DLL을 .NET Reflector로 로딩한 후 assembly 수준의 Debuggable 특성을 확인한 결과 2로 나왔습니다.

[assembly: System.Diagnostics.Debuggable(0x02)]

이 값의 의미는,

DebuggableAttribute Class
; https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggableattribute

[ComVisible(true)]
[Flags]
public enum DebuggingModes
{
    None = 0,
    Default = 1,
    IgnoreSymbolStoreSequencePoints = 2,
    EnableEditAndContinue = 4,
    DisableOptimizations = 256
}

단지 IgnoreSymbolStoreSequencePoints가 지정된 것에 불과합니다. 대개의 경우, Release 모드로 빌드하면 Debuggable(2)로 뜨고, Debug 모드로 빌드하면 다음과 같은 구성의,

0x107 = 263
        DisableOptimizations | EnableEditAndContinue | IgnoreSymbolStoreSequencePoints | Default

Debuggable(0x107)로 나오기 때문에 분명히 Release 빌드로 된 것이 맞습니다. 음... 정말 이상하군요. ^^

문제를 밝혀내기 위해 DLL을 참조하는 프로젝트의 .csproj 파일에서 참조 대상을 살펴봤습니다.

<ProjectReference Include="..\Externals\Test.Deployment\Test.Deployment.csproj">
    <Project>{ac0d50da-96df-4395-87d4-de04c2c232ae}</Project>
    <Name>Test.Deployment</Name>
</ProjectReference>

분명히 프로젝트 참조로 되어 있고, Test.Deployment.csproj의 속성 창을 띄워도 Debug 빌드로 명시가 되어 있습니다. 오호~~~ 정말 신기한 경우입니다. ^^;



그래도 우여곡절 끝에 다행히 원인이 밝혀졌습니다. ^^ 해당 프로젝트에 포함된 AssemblyInfo.cs 파일에 다음과 같이 Debuggable 특성의 값이 명시되어 있던 것이 문제였습니다.

[assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]

위의 특성 값이 명시된 사연은 이러합니다. 해당 소스 코드는 .NET Reflector를 통해 DLL로부터 "Export Source Code..." 기능으로 얻은 것이었는데, 마침 그 원본 DLL의 빌드 상태가 Release 빌드였기 때문에 그 특성이 그대로 소스 코드로 출력된 것이었습니다.

정리하자면, .NET Reflector와 같은 역 어셈블 도구로 구한 소스 코드의 경우 지정된 Debuggable 특성의 값을 지워주는 것이 권장됩니다. ^^





[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 7/17/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 31  32  33  34  35  36  37  38  39  40  41  42  43  [44]  45  ...
NoWriterDateCnt.TitleFile(s)
12519정성태1/30/20217369개발 환경 구성: 525. 오라클 클라우드의 VM을 외부에서 접근하기 위해 포트 여는 방법
12518정성태1/30/202124796Linux: 37. Ubuntu에 Wireshark 설치 [2]
12517정성태1/30/202112372Linux: 36. 윈도우 클라이언트에서 X2Go를 이용한 원격 리눅스의 GUI 접속 - 우분투 20.04
12516정성태1/29/20219031Windows: 188. Windows - TCP default template 설정 방법
12515정성태1/28/202110184웹: 41. Microsoft Edge - localhost에 대해 http 접근 시 무조건 https로 바뀌는 문제 [3]
12514정성태1/28/202110518.NET Framework: 1021. C# - 일렉트론 닷넷(Electron.NET) 소개 [1]파일 다운로드1
12513정성태1/28/20218562오류 유형: 698. electronize - User Profile 디렉터리에 공백 문자가 있는 경우 빌드가 실패하는 문제 [1]
12512정성태1/28/20218369오류 유형: 697. The program can't start because VCRUNTIME140.dll is missing from your computer. Try reinstalling the program to fix this problem.
12511정성태1/27/20218107Windows: 187. Windows - 도스 시절의 8.3 경로를 알아내는 방법
12510정성태1/27/20218478.NET Framework: 1020. .NET Core Kestrel 호스팅 - Razor 지원 추가 [1]파일 다운로드1
12509정성태1/27/20219465개발 환경 구성: 524. Jupyter Notebook에서 C#(F#, PowerShell) 언어 사용을 위한 환경 구성 [3]
12508정성태1/27/20218045개발 환경 구성: 523. Jupyter Notebook - Slide 플레이 버튼이 없는 경우
12507정성태1/26/20218162VS.NET IDE: 157. Visual Studio - Syntax Visualizer 메뉴가 없는 경우
12506정성태1/25/202111396.NET Framework: 1019. Microsoft.Tye 기본 사용법 소개 [1]
12505정성태1/23/20219203.NET Framework: 1018. .NET Core Kestrel 호스팅 - Web API 추가 [1]파일 다운로드1
12504정성태1/23/202110323.NET Framework: 1017. .NET 5에서의 네트워크 라이브러리 개선 (2) - HTTP/2, HTTP/3 관련 [1]
12503정성태1/21/20218587오류 유형: 696. C# - HttpClient: Requesting HTTP version 2.0 with version policy RequestVersionExact while HTTP/2 is not enabled.
12502정성태1/21/20219306.NET Framework: 1016. .NET Core HttpClient의 HTTP/2 지원파일 다운로드1
12501정성태1/21/20218382.NET Framework: 1015. .NET 5부터 HTTP/1.1, 2.0 선택을 위한 HttpVersionPolicy 동작 방식파일 다운로드1
12500정성태1/21/20218980.NET Framework: 1014. ASP.NET Core(Kestrel)의 HTTP/2 지원 여부파일 다운로드1
12499정성태1/20/202110187.NET Framework: 1013. .NET Core Kestrel 호스팅 - 포트 변경, non-localhost 접속 지원 및 https 등의 설정 변경 [1]파일 다운로드1
12498정성태1/20/20219131.NET Framework: 1012. .NET Core Kestrel 호스팅 - 비주얼 스튜디오의 Kestrel/IIS Express 프로파일 설정
12497정성태1/20/202110038.NET Framework: 1011. C# - OWIN Web API 예제 프로젝트 [1]파일 다운로드2
12496정성태1/19/20218904.NET Framework: 1010. .NET Core 콘솔 프로젝트에서 Kestrel 호스팅 방법 [1]
12495정성태1/19/202111006웹: 40. IIS의 HTTP/2 지원 여부 - h2, h2c [1]
12494정성태1/19/202110173개발 환경 구성: 522. WSL2 인스턴스와 호스트 측의 Hyper-V에 운영 중인 VM과 네트워크 연결을 하는 방법 [2]
... 31  32  33  34  35  36  37  38  39  40  41  42  43  [44]  45  ...