posts - 463, comments - 1515, trackbacks - 139

Breaking change inedita nell'app.config del framework 2.0

Non ne ho trovato traccia nel documento che riassume le breaking changes, tantomeno ho trovato qualcosa con google.

L'argomento è la rimozione di un trace listener via app.config. In pratica la possibilità di aggiungere/rimuovere un tracelistener (cioè l'output, ad esempio, di una System.Diagnostics.Trace.WriteLine) senza la necessità di dover ricompilare l'assembly.

Framework 1.1:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDiagnosticsTraceListenerClassTopic.asp
        <listeners>
           <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\myListener.log" />
           <!-- You must supply a valid fully qualified assembly name here. -->
           <remove type="Assembly text name, Version, Culture, PublicKeyToken"/>
        </listeners>

Framework 2.0:
http://msdn2.microsoft.com/hy72797k(en-US,VS.80).aspx
      <listeners>
        <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TextWriterOutput.log" />
        <remove name="Default" />
      </listeners>

Se non viene fatto questo cambiamento, nel framework 2.0 viene lanciata l'eccezione ConfigurationErrorsException:
"Unrecognized attribute 'type'. Note that attribute names are case-sensitive."

La cosa ancora più strana, che puzza tanto di bug, è che facendo partire il progetto sotto debug e poi procedendo step-by-step, l'eccezione non viene generata e tutto funziona!

Ovviamente ho dato già feedback sull'apposito sito.

Print | posted on martedì 10 gennaio 2006 11.52 |

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 8 and 3 and type the answer here:

Powered by: