1

当我尝试从 Visual Studio 启动我正在处理的项目时,最后出现错误。直到几个小时前它工作得很好。经过一些小的无关更改后,它在从 Visual Studio 启动时停止工作。从资源管理器运行时它工作正常。即使是旧版本的 vom 修订控制(这部分代码完全相同并且可以正常工作)的行为方式相同,因此在我的代码中似乎不是问题。

Program.cs:line 14 的代码如下:

private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();

关于如何解决这个问题的任何想法?

System.TypeInitializationException was unhandled Message=The type initializer for ...' threw an exception. Source=... TypeName=... StackTrace: at ....Main(String[] args) at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.Runtime.InteropServices.SEHException Message=External component has thrown an exception. Source=mscorlib ErrorCode=-2147467259 StackTrace: at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl) at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence() at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType) at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType) at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate) at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type) at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed) at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType) at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate) at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type) at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext() at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext() at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName) at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath) at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at NLog.Config.XmlLoggingConfiguration.get_AppConfig() at NLog.LogFactory.get_Configuration() at NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey) at NLog.LogFactory.GetLogger(String name) at NLog.LogManager.GetCurrentClassLogger() at ....Program..cctor() in C:\...\Program.cs:line 14 InnerException:

4

1 回答 1

0

查看 Avira 支持网站上的以下帖子,了解问题的详细信息和解决方法。该问题与上次产品更新有关:

http://www.avira.com/en/support-for-business-knowledgebase-detail/kbid/805

于 2010-12-10T10:02:29.863 回答