B
Bill Cohagan
In my c# app I create a TextWriterTraceListener object and add it to the
Listeners collection via a call to Trace.Listeners.Add(...). This works
fine in my application; however it causes the unit tests to fail when the
code gets run via NUnit tests. This appears to be some kind of permissions
problem, probably related to the fact that NUnit is running my tests through
reflection, but I don't have a clue how to proceed. Any suggestions or
pointers would be appreciated...
The error that is thrown is:
c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config Request
for the permission of type
System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
(c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config)
and the stack trace is:at System.Configuration.ConfigurationRecord.OpenXmlTextReader(String
configFileName)
at System.Configuration.ConfigurationRecord.Load(String filename)
at
System.Configuration.DefaultConfigurationSystem.System.Configuration.IConfig
urationSystem.Init()
at
System.Configuration.ConfigurationSettings.SetConfigurationSystem(IConfigura
tionSystem configSystem)
at System.Configuration.ConfigurationSettings.GetConfig(String
sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigTable()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
at System.Diagnostics.TraceInternal.InitializeSettings()
at System.Diagnostics.TraceInternal.get_Listeners()
at System.Diagnostics.Trace.get_Listeners()
at gptg.QAtoQB.Transactions.Transaction.DumpLog(StreamWriter sw) in
c:\working barrel\tq finint\qatoqb\transactions\transactions.cs:line 46
at gptg.QAtoQB.Transactions.ProcessModel.SaveIIF() in c:\working
barrel\tq finint\qatoqb\transactions\processmodel.cs:line 168
at gptg.QAtoQB.Tests.IIFTests.BillableTime() in c:\working barrel\tq
finint\qatoqb\tests\iiftests.cs:line 29
Listeners collection via a call to Trace.Listeners.Add(...). This works
fine in my application; however it causes the unit tests to fail when the
code gets run via NUnit tests. This appears to be some kind of permissions
problem, probably related to the fact that NUnit is running my tests through
reflection, but I don't have a clue how to proceed. Any suggestions or
pointers would be appreciated...
The error that is thrown is:
c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config Request
for the permission of type
System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
(c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config)
and the stack trace is:at System.Configuration.ConfigurationRecord.OpenXmlTextReader(String
configFileName)
at System.Configuration.ConfigurationRecord.Load(String filename)
at
System.Configuration.DefaultConfigurationSystem.System.Configuration.IConfig
urationSystem.Init()
at
System.Configuration.ConfigurationSettings.SetConfigurationSystem(IConfigura
tionSystem configSystem)
at System.Configuration.ConfigurationSettings.GetConfig(String
sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigTable()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
at System.Diagnostics.TraceInternal.InitializeSettings()
at System.Diagnostics.TraceInternal.get_Listeners()
at System.Diagnostics.Trace.get_Listeners()
at gptg.QAtoQB.Transactions.Transaction.DumpLog(StreamWriter sw) in
c:\working barrel\tq finint\qatoqb\transactions\transactions.cs:line 46
at gptg.QAtoQB.Transactions.ProcessModel.SaveIIF() in c:\working
barrel\tq finint\qatoqb\transactions\processmodel.cs:line 168
at gptg.QAtoQB.Tests.IIFTests.BillableTime() in c:\working barrel\tq
finint\qatoqb\tests\iiftests.cs:line 29