影子复制,以及从任意文件夹加载的混合C#和C ++ DLL [英] Shadow Copying, and mixed C# and C++ DLLs loading from arbitrary folders

查看:214
本文介绍了影子复制,以及从任意文件夹加载的混合C#和C ++ DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VS 2005 C#项目,它使用一个特殊的Plugin文件夹来加载额外的DLL(用作资产转换过程中的节点)。



我有一个C#和C ++ DLL的混合在这个文件夹。



我的问题是,当启用卷影复制时,C ++ DLL拒绝使用Assembly.LoadFrom加载。我试图创建一个自定义的应用程序域,并使用Load,但是这也失败了。



最后,我尝试读取DLL作为byte []数据并使用Load在那里 - 再次,只有C#DLL将以这种方式工作,并出现错误附加信息:无法验证的代码失败的策略检查(来自HRESULT的异常:0x80131402)。



网上的一篇文章提示我在构建那个特定的DLL时尝试使用/ clr:safe,但是由于Microsoft代码中的数千个错误,它根本无法构建(显然)



禁用卷影复制功能后,LoadFrom适用于所有DLL。这个应用程序本身就是Maya的一个插件,而这个用来和Maya 8.5一起工作,但是在2008/2009年失败(如果启用了影子复制)。



我们真的很喜欢因为它可以防止在应用程序运行时DLL文件锁定(Plugins文件夹存储在应用程序运行时Perforce可以更新的位置)。



任何关于如何说服Shadow Copy可以使用自定义文件夹以及混合使用C#/ C ++ DLL而没有这些问题的想法?

解决方案

听起来像一个信任问题。尝试获取Fusion日志(请参阅此博文 )。您的C ++ DLL无法验证,因为它们未编译为 / clr:safe ,因此只能以完全信任方式加载。大概当影子复制时,下载缓存位置没有完全信任。



运行 caspol -s 可能会得到如果这是一个开发问题,您就可以开始运行。


I have a VS 2005 C# project that uses a special Plugin folder to load extra DLLs (for use as nodes in an asset conversion process).

I have a mixture of C# and C++ DLLs in this folder.

The issue I have is that when Shadow Copying is enabled, the C++ DLLs refuse to load using Assembly.LoadFrom. I have attempted to create a custom app domain, and used Load, but this also failed.

Finally, I tried reading the DLL in as byte[] data and using Load on that - again, only the C# DLLs would work this way, with an error "Additional information: Unverifiable code failed policy check. (Exception from HRESULT: 0x80131402)".

An article on the net prompted me to attempt to use /clr:safe when building that particular DLL, but then it simply failed to build due to thousands of errors in Microsoft code... (apparently)

With Shadow Copying disabled, LoadFrom works fine for all DLLs. The app is itself a plugin for Maya, and this used to work with Maya 8.5 but fails with 2008 / 2009 (if Shadow Copying is enabled).

We really would prefer to use Shadow Copying, because it prevents DLL file locks when the app is running (the Plugins folder is stored in a location that Perforce can update while the app is running).

Any ideas as to how I can persuade Shadow Copying to work with a custom folder AND a mix of C# / C++ DLLs without these problems?

解决方案

Sounds like a trust issue. Try getting a Fusion log (see this blog post). Your C++ DLLs are unverifiable since they weren't compiled with /clr:safe, so they can only be loaded as full trust. Presumably when shadow copying, the download cache location doesn't have full trust.

Running caspol -s may get you up and running if this is a development-only issue.

这篇关于影子复制,以及从任意文件夹加载的混合C#和C ++ DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆