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

(시리즈 글이 15개 있습니다.)
디버깅 기술: 22. VS.NET SP1 + .NET Framework 소스 코드 디버깅
; https://www.sysnet.pe.kr/2/0/623

개발 환경 구성: 112. Visual Studio 2010 - .NET Framework 소스 코드 디버깅
; https://www.sysnet.pe.kr/2/0/1009

디버깅 기술: 47. .NET Reflector를 이용한 "소스 코드가 없는" 어셈블리 디버깅
; https://www.sysnet.pe.kr/2/0/1201

개발 환경 구성: 143. Visual Studio 2010 - .NET Framework 소스 코드 디버깅 - 두 번째 이야기
; https://www.sysnet.pe.kr/2/0/1243

개발 환경 구성: 297. 소스 코드가 없는 닷넷 어셈블리를 디버깅할 때 지역 변숫값을 확인하는 방법
; https://www.sysnet.pe.kr/2/0/11036

개발 환경 구성: 391. (GitHub 등과 직접 연동해) 소스 코드 디버깅을 쉽게 해 주는 SourceLink
; https://www.sysnet.pe.kr/2/0/11630

VS.NET IDE: 126. 디컴파일된 소스에 탐색을 사용하도록 설정(Enable navigation to decompiled sources)
; https://www.sysnet.pe.kr/2/0/11689

VS.NET IDE: 145. NuGet + Github 라이브러리 디버깅 관련 옵션 3가지 - "Enable Just My Code" / "Enable Source Link support" / "Suppress JIT optimization on module load (Managed only)"
; https://www.sysnet.pe.kr/2/0/12200

VS.NET IDE: 149. ("Binary was not built with debug information" 상태로) 소스 코드 디버깅이 안되는 경우
; https://www.sysnet.pe.kr/2/0/12278

개발 환경 구성: 500. (PDB 연결이 없는) DLL의 소스 코드 디버깅을 dotPeek 도구로 해결하는 방법
; https://www.sysnet.pe.kr/2/0/12281

VS.NET IDE: 153. 닷넷 응용 프로그램에서의 "My Code" 범위와 "Enable Just My Code"의 역할
; https://www.sysnet.pe.kr/2/0/12401

VS.NET IDE: 170. Visual Studio에서 .NET Core/5+ 역어셈블 소스코드 확인하는 방법
; https://www.sysnet.pe.kr/2/0/12880

VS.NET IDE: 177. 비주얼 스튜디오 2022를 이용한 (소스 코드가 없는) 닷넷 모듈 디버깅 - "외부 원본(External Sources)"
; https://www.sysnet.pe.kr/2/0/13109

VS.NET IDE: 180. Visual Studio - 닷넷 소스 코드 디버깅 중 "Decompile source code"가 동작하는 않는 문제
; https://www.sysnet.pe.kr/2/0/13247

VS.NET IDE: 189. Visual Studio - 닷넷 소스코드 디컴파일 찾기가 안 될 때
; https://www.sysnet.pe.kr/2/0/13554




Visual Studio - 닷넷 소스 코드 디버깅 중 "Decompile source code"가 동작하는 않는 문제

최근의 Visual Studio에서 분명히 decompiled 시킨 어셈블리임에도 불구하고,

vs_gen_src_access_0.png

정작 Call Stack에서 해당 코드를 보려고 더블 클릭을 하면 곧바로 소스 코드가 보이지 않고 다음과 같은 창이 뜹니다.

vs_gen_src_access_1.png

"Decompile source code" 링크를 클릭해도 해당 소스 코드가 열리지 않는데요, 디컴파일된 소스 코드 위치를 찾아,

C:\> dir /a/s FileChangesMonitor.cs
 Volume in drive C has no label.
 Volume Serial Number is 7090-BBAB

 Directory of %LOCALAPPDATA%\Temp\.vsdbgsrc\2E5F9520028DF5D1934C4EF28AB8655FBAFE89A456A92B6F3491798DF6DFE690

2023-01-31  오후 04:39            23,277 FileChangesMonitor.cs
               1 File(s)         23,277 bytes

     Total Files Listed:
               1 File(s)         23,277 bytes
               0 Dir(s)  567,419,895,808 bytes free

C:\>

"Browse and find CacheDependency.cs..." 링크를 눌러 위의 위치를 지정했더니 이런 오류 창이 뜹니다.

Find Source: CacheDependency.cs

FileChangesMonitor.cs
You don’t have permission to open this file. 

Contact the file owner or an administrator to obtain permission.

재미있는 건, 실제로 해당 파일에 대한 접근 권한이 없다는 점입니다.

vs_gen_src_access_2.png

게다가 관리자 권한은 물론 시스템 권한으로도 소유권을 가져올 수 없습니다.

c:\temp> takeown /f "%LOCALAPPDATA%\Temp\.vsdbgsrc\2E5F...[생략]...6DFE690\FileChangesMonitor.cs" /a /r /d y
ERROR: Access is denied.

어쩔 수 없습니다. ^^; 이런 경우 그냥 .vsdbgsrc 하위 디렉터리를 전부 삭제하는 식으로 해결할 수 있습니다. 다행히 파일 자체에 대한 권한이 막힌 것이어서 그것을 포함한 디렉터리는 삭제가 가능합니다. 그다음, 다시 Visual Studio의 Modules 창(단축키: Ctrl+Alt+U)에서,

vs_gen_src_access_3.png

"Extract Source Code" 메뉴를 이용해 DLL로부터 소스 코드 파일을 생성하면 이후 소스 코드 디버깅이 다시 잘 되는 것을 확인할 수 있습니다.




"Extract Source Code"를 (실행했던 적이 아닌) 실행한 Visual Studio가 열려 있는 경우, 생성된 소스 코드들은 현재의 Visual Studio가 배타적으로 열고 있어 다른 에디터에서 열려고 하면 오류가 발생하는 경우도 있습니다.

The process cannot access the file because it is being used by another process.

만약, 소스 코드 디버깅이 안 돼서 "Extract Source Code" 작업을 다시 해야 하는 경우라면 그냥 Visual Studio를 종료하고 파일 탐색기를 이용해 지우면 됩니다. 혹은, "Tools" 메뉴의 "External Tools..."에,

Visual Studio - External Tools에 Shell 내장 명령어 등록
; https://www.sysnet.pe.kr/2/0/13244

다음과 같은 설정으로 등록해 두면 이후 편리하게 쓸 수 있을 것입니다. ^^

Command: %comspec%
Arguments: /C rmdir /s /q "%LOCALAPPDATA%\Temp\.vsdbgsrc"




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







[최초 등록일: ]
[최종 수정일: 7/20/2023]

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

비밀번호

댓글 작성자
 




... 121  122  123  124  [125]  126  127  128  129  130  131  132  133  134  135  ...
NoWriterDateCnt.TitleFile(s)
10797정성태5/23/201521555VC++: 91. 자식 스레드에 자동 상속되는 TEB의 SubProcessTag 필드파일 다운로드1
10796정성태5/23/201532384오류 유형: 293. SQL Server Management Studio 실행 시 "Cannot find one or more components" 오류
10795정성태5/23/201530501오류 유형: 292. InstallUtil로 .NET 서비스 등록 시 오류 - Operation is not supported. (Exception from HRESULT: 0x80131515). [3]
10794정성태5/22/201525462개발 환경 구성: 267. (무료) 마이크로소프트 온라인 강좌 소개 - 네트워킹 기초 [1]
2925정성태5/14/201525070디버깅 기술: 73. PDB 기호 파일의 경로 구성 방식파일 다운로드1
2924정성태5/14/201528384VS.NET IDE: 100. 비주얼 스튜디오 원격 디버깅 시 'Unknown function' 콜스택이 나온다면?
2923정성태5/12/201587748기타: 52. 도서: 시작하세요! C# 6.0 프로그래밍: 기본 문법부터 실전 예제까지 [17]
2922정성태5/12/201524605오류 유형: 291. ssindex.cmd 실행 시 '...[tfs_collection_url]...' not found in srcsrv.ini 오류 발생
2921정성태5/9/201530952개발 환경 구성: 266. 인텔에서 구현한 최대 절전 모드 기능 - Intel® Rapid Start Technology
2920정성태5/9/201522045오류 유형: 290. 디스크 관리자의 파티션 축소 시, There is not enough space available on the disk(s) to complete this operation.
2919정성태5/9/201521920오류 유형: 289. Error: this template attempted to load component assembly 'NuGet.VisualStudio.Interop, ...'
2918정성태5/9/201540456Windows: 111. 복구(Recovery) 파티션 삭제하는 방법 [3]
2917정성태5/9/201530899오류 유형: 288. .NET Framework 4.6이 설치된 경우 "Intel® Rapid Storage Technology (Intel® RST) RAID Driver"가 설치 안 되는 문제 [5]
2916정성태5/9/201531980오류 유형: 287. 레지스트리 권한 오류 - Cannot edit [Registry key name]: Error writing the value's new contents.
2915정성태5/9/201531115개발 환경 구성: 265. TrustedInstaller 권한으로 프로그램 실행시키는 방법 [11]
2914정성태5/9/201528477DDK: 7. 정식 인증서가 있는 경우 Device Driver 서명하는 방법 [2]
2913정성태4/30/201526210.NET Framework: 511. Build 2015 행사에서 소개된 (맥/리눅스/윈도우 용 무료) Visual Studio Code 개발 도구 [8]
2912정성태4/29/201521958오류 유형: 286. VirtualBox에 Windows 8/2012 설치 시 "Error Code: 0x000000C4" 오류 발생
2911정성태4/29/201520512오류 유형: 285. Visual Studio 2015를 제거한 경우 Microsoft.VisualStudio.Web.PageInspector.Loader 어셈블리를 못 찾는 문제 [2]
2910정성태4/29/201524442오류 유형: 284. System.TypeLoadException: Could not load type 'System.Reflection.AssemblySignatureKeyAttribute' from assembly [1]
2909정성태4/29/201520576오류 유형: 283. WCF 연결 오류 - Expected record type 'PreambleAck'
2908정성태4/29/201528886오류 유형: 282. 원격에서 SQL 서버는 연결되지만, SQL Express는 연결되지 않는 경우
2907정성태4/29/201518918.NET Framework: 510. 제네릭(Generic) 인자에 대한 메타데이터 등록 확인
2906정성태4/28/201521501오류 유형: 281. DebugView로 인한 System.Diagnostics.Trace.WriteLine 멈춤(Hang) 현상
2905정성태4/27/201521918오류 유형: 280. HttpResponse.Headers.Add에서 "System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode." 예외 발생
2904정성태4/27/201527115DDK: 6. ZwTerminateProcess로 프로세스를 종료하는 Device Driver 프로그램 [2]파일 다운로드1
... 121  122  123  124  [125]  126  127  128  129  130  131  132  133  134  135  ...