I get error whenever i start my project in debug mode. This is a windows form project and it throws error in the app.config file. Here is the stack trace details. Any help is much appreciated. I'm working on windows 7 64bit machine on VS2008 SP1.
System.Configuration.ConfigurationErrorsException was unhandled
Message="An error occurred creating the configuration section handler for system.diagnostics: Invalid syntax. (C:\\Progs\\Project1\\Main\\bin\\Debug\\Proj 2.0.vshost.exe.Config line 3)"
Source="System.Configuration"
BareMessage="An error occurred creating the configuration section handler for system.diagnostics: Invalid syntax."
Filename="C:\\Progs\\Project1\\Main\\bin\\Debug\\Proj 2.0 2.0.vshost.exe.Config"
Line=3
StackTrace:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
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, Boolean getLkg, Boolean checkPermission)
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 System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
at System.Diagnostics.TraceSource.Initialize()
at System.Net.Logging.InitializeLogging()
at System.Net.Logging.get_On()
at System.Net.Sockets.TcpListener..ctor(IPAddress localaddr, Int32 port)
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider, IAuthorizeRemotingConnection authorizeCallback)
at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.RegisterChannel(Boolean SecureChannel)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Main.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly 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)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Security.XmlSyntaxException
Message="Invalid syntax."
Source="mscorlib"
StackTrace:
at System.Security.SecurityDocument.GetTagForElement(Int32 position)
at System.Security.Policy.PolicyStatement.FromXml(SecurityDocument doc, Int32 position, PolicyLevel level, Boolean allowInternalOnly)
at System.Security.Policy.PolicyLevel.CheckCache(Int32 count, Char[] serializedEvidence)
at System.Security.Policy.PolicyLevel.Resolve(Evidence evidence, Int32 count, Char[] serializedEvidence)
at System.Security.PolicyManager.CodeGroupResolve(Evidence evidence, Boolean systemPolicy)
at System.Security.PolicyManager.ResolveHelper(Evidence evidence)
at System.Security.HostSecurityManager.ResolvePolicy(Evidence evidence)
at System.Security.PolicyManager.Resolve(Evidence evidence)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence)
at System.Configuration.ClientConfigurationHost.GetRestrictedPermissions(IInternalConfigRecord configRecord, PermissionSet& permissionSet, Boolean& isHostReady)
at System.Configuration.BaseConfigurationRecord.GetRestrictedPermissions()
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSection(Boolean inputIsTrusted, RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
I tried every solution about this and nothing works out. Could anyone help me out in figuring out this problem? I thought it was a problem with VS2008 so i had uninstalled and reinstalled it still i get the same error whenever i start in debug mode.
siabhavaraju
0 Points
7 Posts
An error occurred creating the configuration section handler for system.diagnostics
Mar 29, 2012 03:55 PM|LINK
Hi,
I get error whenever i start my project in debug mode. This is a windows form project and it throws error in the app.config file. Here is the stack trace details. Any help is much appreciated. I'm working on windows 7 64bit machine on VS2008 SP1.
System.Configuration.ConfigurationErrorsException was unhandled
Message="An error occurred creating the configuration section handler for system.diagnostics: Invalid syntax. (C:\\Progs\\Project1\\Main\\bin\\Debug\\Proj 2.0.vshost.exe.Config line 3)"
Source="System.Configuration"
BareMessage="An error occurred creating the configuration section handler for system.diagnostics: Invalid syntax."
Filename="C:\\Progs\\Project1\\Main\\bin\\Debug\\Proj 2.0 2.0.vshost.exe.Config"
Line=3
StackTrace:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
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, Boolean getLkg, Boolean checkPermission)
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 System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
at System.Diagnostics.TraceSource.Initialize()
at System.Net.Logging.InitializeLogging()
at System.Net.Logging.get_On()
at System.Net.Sockets.TcpListener..ctor(IPAddress localaddr, Int32 port)
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider, IAuthorizeRemotingConnection authorizeCallback)
at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.RegisterChannel(Boolean SecureChannel)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Main.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly 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)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Security.XmlSyntaxException
Message="Invalid syntax."
Source="mscorlib"
StackTrace:
at System.Security.SecurityDocument.GetTagForElement(Int32 position)
at System.Security.Policy.PolicyStatement.FromXml(SecurityDocument doc, Int32 position, PolicyLevel level, Boolean allowInternalOnly)
at System.Security.Policy.PolicyLevel.CheckCache(Int32 count, Char[] serializedEvidence)
at System.Security.Policy.PolicyLevel.Resolve(Evidence evidence, Int32 count, Char[] serializedEvidence)
at System.Security.PolicyManager.CodeGroupResolve(Evidence evidence, Boolean systemPolicy)
at System.Security.PolicyManager.ResolveHelper(Evidence evidence)
at System.Security.HostSecurityManager.ResolvePolicy(Evidence evidence)
at System.Security.PolicyManager.Resolve(Evidence evidence)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence)
at System.Configuration.ClientConfigurationHost.GetRestrictedPermissions(IInternalConfigRecord configRecord, PermissionSet& permissionSet, Boolean& isHostReady)
at System.Configuration.BaseConfigurationRecord.GetRestrictedPermissions()
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSection(Boolean inputIsTrusted, RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)
ignatandrei
All-Star
135142 Points
21676 Posts
Moderator
MVP
Re: An error occurred creating the configuration section handler for system.diagnostics
Mar 29, 2012 04:46 PM|LINK
And what's there at line 1,2,3,4,5 and 6?
siabhavaraju
0 Points
7 Posts
Re: An error occurred creating the configuration section handler for system.diagnostics
Mar 29, 2012 04:55 PM|LINK
Here is what i have between lines 1-22.
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
siabhavaraju
0 Points
7 Posts
Re: An error occurred creating the configuration section handler for system.diagnostics
Mar 29, 2012 04:56 PM|LINK
And interestingly i get this error when i debug in windows7 machine but i dont get the same error on windows xp machine.
ignatandrei
All-Star
135142 Points
21676 Posts
Moderator
MVP
Re: An error occurred creating the configuration section handler for system.diagnostics
Mar 30, 2012 03:48 AM|LINK
This is your first line?!
siabhavaraju
0 Points
7 Posts
Re: An error occurred creating the configuration section handler for system.diagnostics
Mar 30, 2012 01:19 PM|LINK
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
siabhavaraju
0 Points
7 Posts
Re: An error occurred creating the configuration section handler for system.diagnostics
Mar 30, 2012 01:26 PM|LINK
These are my first lines
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
siabhavaraju
0 Points
7 Posts
Re: An error occurred creating the configuration section handler for system.diagnostics
Apr 03, 2012 04:15 PM|LINK
I tried every solution about this and nothing works out. Could anyone help me out in figuring out this problem? I thought it was a problem with VS2008 so i had uninstalled and reinstalled it still i get the same error whenever i start in debug mode.
SonicMan
Participant
1472 Points
228 Posts
Re: An error occurred creating the configuration section handler for system.diagnostics
Apr 05, 2012 02:36 AM|LINK
Hi
May be you should ask it in msdn windows forum .
Hope it helpful.
siabhavaraju
0 Points
7 Posts
Re: An error occurred creating the configuration section handler for system.diagnostics
Apr 06, 2012 03:29 PM|LINK
Thanks.