Question

I get the error at the end when I try to start a project I'm working on from Visual Studio. It worked fine until a few hours ago. After some minor unrelated changes it stopped working when starting from Visual Studio. It works fine when run from explorer. Even old version vom revision control (where this part of the code is exactly the same and has worked without any problems) behave the same way so it doesn't seem to be a problem in my code.

The code at Program.cs:line 14 is the following:

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

Any ideas on how to solve this?

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:

Was it helpful?

Solution

Check the following post on the Avira support site for details of the problem and a work around. The issue is related to the last product update:

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top