about uscontact

The Shell and Managed Code

Author: zemna
Date: April 17, 2021
Share this:

이번에 기존에 개발중이던 Shell Extension 프로그램의 코드를 C#으로 변경하면서 계속 내용을 찾아보던중 좀 미심쩍은 부분이였는데, 마이크로소프트 MSDN에 명시가 되어 있었다.. ㅠㅠ

Shell extensions should not include managed code. Shell extensions are loaded into all processes that use the Shell namespace and run in-process by definition. Managed code built against one version of the common language runtime might not run in a process running a different version of the common language runtime. At this time, only one version of the common language runtime can be loaded into a process at one time. Therefore, Microsoft recommends against writing managed Shell extensions and does not consider them a supported scenario.

For instance, if you wrote a managed Shell extension, then every application on the computer that has a file Open dialog box would have that managed code and its attendant common language runtime dependency injected into the application's process. The application or extension that is first to load its required version of the Microsoft .NET Framework into that process restricts the process to using that particular version of Framework. If a managed application with an Open dialog box is built on an older version of the Framework than your Shell extension requires, then your extension could fail to run correctly and could cause errors in the application. Conversely, if your Shell extension is the first to load in a process and managed code tries to launch after that (perhaps a managed application or a running application loads the common language runtime on demand), the later code has to use the version of the Framework that was loaded by the Shell extension, whether compatible or not, again leading to the possibility of an application failure.

Developers will be tempted to devise schemes to mitigate the issue, including Component Object Model (COM) wrappers for managed objects, but in the end, each, no matter how convoluted or careful, comes back to the potential for a version conflict in an in-process object. Therefore, we strongly recommend against using any single-instance-per-process runtime or library (such as the Framework, Microsoft XML (MSXML), or Java) in a Shell extension. If you are developing a Shell extension, do so with unmanaged code.

내용을 요약하자면, 하나의 프로세스에서는 한번에 1개 버전의 CLR(Common Language Runtime)만 로드될 수 있기 때문에, 마이크로소프트에서는 관리되는 Shell Extension을 개발하는 것을 지향하고 있다는 내용이다.

그동안 몇시간동안 바꿨었던 내용을 다시 돌려야 하나보다.. 😥

정말 VC++ 과 C#의 생산성이란 비교할 수가 없건만 ㅠㅠ

참고 : http://msdn.microsoft.com/en-us/library/dd758089{83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}28VS.85{83832c2e9762d7d59158bb8e184331dad143c7b73eb69f86229ee6e276689139}29.aspx

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *


Professional software development agency estalished in Indonesia. We offers website setup, web application development, fulfillment service, and etc.
Follow us
Follow us to get latest news and tutorials.
2022 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️