Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 2개 있습니다.)

Visual Studio 디버깅 - Unable to break execution. This process is not currently executing the type of code that you selected to debug.

이상한 현상이 발생했습니다. ^^; .NET Framework 2.0 대상으로 빌드한 프로젝트가 디버깅이 안되는 희한한 일이 눈 앞에 펼쳐진 것입니다.

not_stop_debug_1.png

위의 그림처럼, BP(Breakpoint)를 걸어도 안 걸리고, "Break All (Ctrl + Alt + Break)"을 걸어도 정황상 도저히 이해할 수 없는 메시지 창만 나오는 것입니다.

"
Unable to break execution. This process is not currently executing the type of code that you selected to debug.
"


검색을 해보니, 다행히 힌트를 얻을 수 있는 글이 하나 나왔는데요. ^^

Hitting breakpoints in .NET Class Libraries while debugging with Visual Studio 2010
; http://through-the-interface.typepad.com/through_the_interface/2010/04/hitting-breakpoints-in-net-class-libraries-while-debugging-with-visual-studio-2010.html

마침 이 현상을 겪었던 프로젝트는 app.config에 다음과 같은 설정을 가지고 있었습니다.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0.30319"/>
        <supportedRuntime version="v2.0.50727"/>
    </startup>
</configuration>

왜 이렇게 했는지는 아래에 설명을 한 적이 있습니다.

supportedRuntime 옵션과 System.BadImageFormatException 예외
; https://www.sysnet.pe.kr/2/0/1233

정리해 보면!

디버깅을 시도한 프로젝트는 csproj에 .NET 2.0을 사용한다고 명시했지만 app.config의 영향으로 실제 EXE 프로그램이 실행될 때는 .NET 4.0 런타임이 올라온 것입니다. 하지만 Visual Studio는 csproj 파일에 의해 .NET 2.0 응용 프로그램이라고 판단하고 그대로 2.0 디버그 엔진을 사용하였기 때문입니다.

어쩔 수 없습니다. 이런 프로그램을 디버깅할 때는 app.config의 내용을 잠시 주석처리하거나, "Debug" / "Attach to Process..." 메뉴를 이용하여 실행 시에 Visual Studio 디버거를 붙이는 수밖에 없습니다. (원천적으로는, Visual Studio가 app.config을 인식해서 디버거를 구동해 주는 것이 맞겠지요. ^^)




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

[연관 글]






[최초 등록일: ]
[최종 수정일: 6/27/2021]

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

비밀번호

댓글 작성자
 




... 136  137  138  139  140  141  142  143  144  145  146  147  148  149  [150]  ...
NoWriterDateCnt.TitleFile(s)
1299정성태6/18/201232720제니퍼 .NET: 21. 제니퍼 닷넷 - Ninject DI 프레임워크의 성능 분석 [2]파일 다운로드2
1298정성태6/14/201234225VS.NET IDE: 72. Visual Studio에서 pfx 파일로 서명한 경우, 암호는 어디에 저장될까? [2]
1297정성태6/12/201230825VC++: 63. 다른 프로세스에 환경 변수 설정하는 방법파일 다운로드1
1296정성태6/5/201227486.NET Framework: 328. 해당 DLL이 Managed인지 / Unmanaged인지 확인하는 방법 - 두 번째 이야기 [4]파일 다운로드1
1295정성태6/5/201224919.NET Framework: 327. RSAParameters와 System.Numerics.BigInteger 이야기파일 다운로드1
1294정성태5/27/201248329.NET Framework: 326. 유니코드와 한글 - 유니코드와 닷넷을 이용한 한글 처리 [7]파일 다운로드2
1293정성태5/24/201229566.NET Framework: 325. System.Drawing.Bitmap 데이터를 Parallel.For로 처리하는 방법 [2]파일 다운로드1
1292정성태5/24/201223615.NET Framework: 324. First-chance exception에 대해 조건에 따라 디버거가 멈추게 할 수는 없을까? [1]파일 다운로드1
1291정성태5/23/201230072VC++: 62. 배열 초기화를 위한 기계어 코드 확인 [2]
1290정성태5/18/201234893.NET Framework: 323. 관리자 권한이 필요한 작업을 COM+에 대행 [7]파일 다운로드1
1289정성태5/17/201239038.NET Framework: 322. regsvcs.exe로 어셈블리 등록 시 시스템 변경 사항 [5]파일 다운로드2
1288정성태5/17/201226219.NET Framework: 321. regasm.exe로 어셈블리 등록 시 시스템 변경 사항 (3) - Type Library파일 다운로드1
1287정성태5/17/201229099.NET Framework: 320. regasm.exe로 어셈블리 등록 시 시스템 변경 사항 (2) - .NET 4.0 + .NET 2.0 [2]
1286정성태5/17/201238056.NET Framework: 319. regasm.exe로 어셈블리 등록 시 시스템 변경 사항 (1) - .NET 2.0 + x86/x64/AnyCPU [5]
1285정성태5/16/201233077.NET Framework: 318. gacutil.exe로 어셈블리 등록 시 시스템 변경 사항파일 다운로드1
1284정성태5/15/201225487오류 유형: 155. Windows Phone 연결 상태에서 DRIVER POWER STATE FAILURE 블루 스크린 뜨는 현상
1283정성태5/12/201233091.NET Framework: 317. C# 관점에서의 Observer 패턴 구현 [1]파일 다운로드1
1282정성태5/12/201225924Phone: 6. Windows Phone 7 Silverlight에서 Google Map 사용하는 방법 [3]파일 다운로드1
1281정성태5/9/201233026.NET Framework: 316. WPF/Silverlight의 그래픽 단위와 Anti-aliasing 처리를 이해하자 [1]파일 다운로드1
1280정성태5/9/201225959오류 유형: 154. Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, ...'.
1279정성태5/9/201224737.NET Framework: 315. 해당 DLL이 Managed인지 / Unmanaged인지 확인하는 방법 [1]파일 다운로드1
1278정성태5/8/201225955오류 유형: 153. Visual Studio 디버깅 - Unable to break execution. This process is not currently executing the type of code that you selected to debug.
1277정성태5/8/201231152오류 유형: 152. cmd.exe - The system cannot write to the specified device. [2]
1276정성태4/28/201222944Phone: 5. 모든 Marketplace에 윈폰 앱을 등록하는 방법 [1]
1275정성태4/28/201226858개발 환경 구성: 150. 프로세스 실행으로 잠긴 파일이지만, 이름은 변경가능하다는 사실! 아셨나요? [7]
1274정성태4/17/201221423Phone: 4. "Holiday Calendar" 윈폰 응용 프로그램 등록
... 136  137  138  139  140  141  142  143  144  145  146  147  148  149  [150]  ...