Microsoft MVP성태의 닷넷 이야기
오류 유형 : 85. DEP 비호환 ActiveX 오류 [링크 복사], [링크+제목 복사],
조회: 24126
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 3개 있습니다.)
DEP 비호환 ActiveX 오류


DEP가 간혹 문제가 되고 있습니다. 예전에도 DEP 활성화된 시스템에서 이에 호환되지 않는 ActiveX를 사용할 때 오류나는 경우를 한번 소개해 드렸지요.

Windowless ActiveX controls are not supported 
; https://www.sysnet.pe.kr/2/0/582

근데, DEP 문제로 인한 ActiveX 활성화 오류가 꼭 위와 같지는 않더군요.
예를 들어, 제가 최근에 다뤘던 어떤 구형 ActiveX는 실행시에 다음과 같이 오류가 발생했습니다.

[그림 1: DEP 로 인한 ActiveX 활성 오류]
dep_ax_activation_error_1.png

이번에도 역시 "((System.ComponentModel.ISupportInitialize)(this.axXObject1)).EndInit();" 에서 오류가 발생하긴 했는데, 이번엔 메시지가 다릅니다.

System.InvalidOperationException was unhandled
  Message="Cross-thread operation not valid: Control 'axFBPlayer1' accessed from a thread other than the thread it was created on."
  Source="System.Windows.Forms"
  StackTrace:
       at System.Windows.Forms.Control.get_Handle()
       at System.Windows.Forms.Control.SetParentHandle(IntPtr value)
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.AxHost.EndInit()
       at WindowsFormsApplication1.Form1.InitializeComponent()
       at WindowsFormsApplication1.Form1..ctor()
       at WindowsFormsApplication1.Program.Main()
  InnerException: 

어쨌든, 이런 경우에 봐야 할 것은 DEP 해결인데, NXCOMPAT 옵션을 명시적으로 해제하는 방법이 C# 프로젝트 설정창에는 제공되지 않기 때문에 별도의 빌드 이벤트를 구성하는 것으로 우회해서 처리할 수 있습니다. (DEP는 EXE 프로세스 수준에서 적용되는 것이기 때문에 ActiveX 오류일지라도 EXE 에서 NXCOMPAT를 수정해 주면 됩니다.)

우회 방법은 아래의 글에서 잘 설명해 주고 있습니다.

NXCOMPAT and the C# compiler 
; https://learn.microsoft.com/en-us/archive/blogs/ed_maurer/nxcompat-and-the-c-compiler

그래서, 다음과 같은 빌드 이벤트 구성이면 된다는!

call "$(DevEnvDir)..\tools\vsvars32.bat"
editbin.exe /NXCOMPAT:NO "$(TargetPath)"



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

[연관 글]






[최초 등록일: ]
[최종 수정일: 12/20/2022]

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

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  8  [9]  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13412정성태9/14/20237074닷넷: 2142. C# 12 - 인라인 배열(Inline Arrays) [1]
13411정성태9/12/20233569Windows: 252. 권한 상승 전/후 따로 관리되는 공유 네트워크 드라이브 정보
13410정성태9/11/20235105닷넷: 2141. C# 12 - Interceptor (컴파일 시에 메서드 호출 재작성) [1]
13409정성태9/8/20233934닷넷: 2140. C# - Win32 API를 이용한 모니터 전원 끄기
13408정성태9/5/20233909Windows: 251. 임의로 만든 EXE 파일을 포함한 ZIP 파일의 압축을 해제할 때 Windows Defender에 의해 삭제되는 경우
13407정성태9/4/20233629닷넷: 2139. C# - ParallelEnumerable을 이용한 IEnumerable에 대한 병렬 처리
13406정성태9/4/20233612VS.NET IDE: 186. Visual Studio Community 버전의 라이선스
13405정성태9/3/20234023닷넷: 2138. C# - async 메서드 호출 원칙
13404정성태8/29/20233597오류 유형: 876. Windows - 키보드의 등호(=, Equals sign) 키가 눌리지 않는 경우
13403정성태8/21/20233398오류 유형: 875. The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
13402정성태8/20/20233499닷넷: 2137. ILSpy의 nuget 라이브러리 버전 - ICSharpCode.Decompiler
13401정성태8/19/20233752닷넷: 2136. .NET 5+ 환경에서 P/Invoke의 성능을 높이기 위한 SuppressGCTransition 특성 [1]
13400정성태8/10/20233589오류 유형: 874. 파이썬 - pymssql을 윈도우 환경에서 설치 불가
13399정성태8/9/20233514닷넷: 2135. C# - 지역 변수로 이해하는 메서드 매개변수의 값/참조 전달
13398정성태8/3/20234357스크립트: 55. 파이썬 - pyodbc를 이용한 SQL Server 연결 사용법
13397정성태7/23/20233847닷넷: 2134. C# - 문자열 연결 시 string.Create를 이용한 GC 할당 최소화
13396정성태7/22/20233621스크립트: 54. 파이썬 pystack 소개 - 메모리 덤프로부터 콜 스택 열거
13395정성태7/20/20233498개발 환경 구성: 685. 로컬에서 개발 중인 ASP.NET Core/5+ 웹 사이트에 대해 localhost 이외의 호스트 이름으로 접근하는 방법
13394정성태7/16/20233473오류 유형: 873. Oracle.ManagedDataAccess.Client - 쿼리 수행 시 System.InvalidOperationException
13393정성태7/16/20233650닷넷: 2133. C# - Oracle 데이터베이스의 Sleep 쿼리 실행하는 방법
13392정성태7/16/20233545오류 유형: 872. Oracle - ORA-01031: insufficient privileges
13391정성태7/14/20233564닷넷: 2132. C# - sealed 클래스의 메서드를 callback 호출했을 때 인라인 처리가 될까요?
13390정성태7/12/20233502스크립트: 53. 파이썬 - localhost 호출 시의 hang 현상
13389정성태7/5/20233546개발 환경 구성: 684. IIS Express로 호스팅하는 웹을 WSL 환경에서 접근하는 방법
13388정성태7/3/20233691오류 유형: 871. 윈도우 탐색기에서 열리지 않는 zip 파일 - The Compressed (zipped) Folder '[...].zip' is invalid. [1]파일 다운로드1
13387정성태6/28/20233754오류 유형: 870. _mysql - Commands out of sync; you can't run this command now
1  2  3  4  5  6  7  8  [9]  10  11  12  13  14  15  ...