AppDomain证据没有区域? [英] AppDomain Evidence has no Zone?

查看:37
本文介绍了AppDomain证据没有区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么控制着当前应用程序域的证据?

What is controlling the Evidence of the current app domain?

var evidence = Thread.GetDomain().Evidence;

什么控制它为null或非null,什么决定它的内容?

What controls if it is null or non-null, and what determines it contents?

当我的应用程序从域证据中查询这些宿主证据对象时

When my application queries these host evidence objects from the domain evidence

var z = evidence.GetHostEvidence<Zone> 
var p = evidence.GetHostEvidence<Publisher>
var s = evidence.GetHostEvidence<Site>
var n = evidence.GetHostEvidence<StrongName>
var u = evidence.GetHostEvidence<Url>

在某些环境中执行时,似乎有时它们都为空.我认为这是在 IsolatedStorage._GetAccountingInfo(...)中引发的异常的原因,通过查看反射器中的代码,很明显,只有在域证据包含null的情况下才会引发此异常以上所有宿主证据对象.这将导致隔离存储无法初始化.

it appears as if they are sometimes all null when executing in some environments. The reason I believe this is an exception thrown inside IsolatedStorage._GetAccountingInfo(...), where by looking at the code in reflector it is clear that this exception will only be thrown if the domain evidence contains null for all of the above host evidence objects. This will cause isolated storage to fail to initialize.

不幸的是,我无法在自己的系统上重现它.例如,区域"值将始终是一个适当的值,例如我的电脑",因此我正努力解决此问题.

Unfortunately I can't reproduce it on my own system. The Zone value for example will always be a proper value saying "My Computer", so I'm struggling to solve this.

是什么控制Windows窗体桌面应用程序的默认应用程序域中这些值的内容?

What controls the contents of these values in the default app domain of a windows forms desktop application?

推荐答案

事实证明,罪魁祸首确实是汉斯在对我的问题的评论中提出的不寻常的部署方案".我们对一些程序集使用了加密(封装),显然,这会篡改隔离存储所需要的证据.

It turns out the culprit was indeed an "unusual deployment scenario" as was suggested by Hans in a comment on my question. We use encryption (enveloping) for a few assemblies, and apparently this tampers with the evidence required by isolated storage.

这篇关于AppDomain证据没有区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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