Geeks With Blogs
Saqib Ullah BootStrapper Know How

Yesterday when one of my team members opens his project in Visual Studios 2005 he is getting very strange exception.

Exception:
An Exception 'System.TypeInitializationExpection' has occurred in XXXXXXXX-X-XXXXXXXXXXXXXXXXXX.

Replace X’s with chars and its different on every machine.

Click OK and Visual Studio 2005 is shutdown. Everyone in my team scratch their heads oooooooH! my God what the matter it is. Our project is integrated with Visual Source Safe and every one opens the project from VSS. After checking some files in VSS we found that web.config is updated with the following block of code actually we open tracing in our project

Actual Web.Config file

<system.diagnostics>
  <trace autoflush="true" indentsize="2" />
  <listners>
    <remove name="Default"/>
    <add name="TestTrace" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" initializeData="ASHWeb.log" />
  </listners>
</system.diagnostics>

 There is one bug in the above snippets we actually forget to close <trace autoflush="true"> after </listners>.

 Updated Web.Config file:

system.diagnostics>
 
<trace autoflush="true" indentsize="2">
  <listners>
    <remove name="Default"/>
    <add name="TestTrace" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" initializeData="ASHWeb.log" />
  </listners>
 
</trace>
</system.diagnostics>

 Save the web.config file in notepad and open the project in Visual Studio 2005 and this time my project load   successfully.

Note:
If you want to test this scenario in your project may be you didn’t get any exception because your project is not integrated with Visual Source Safe this exception occurs only when project integrated with VSS.

Posted on Sunday, July 8, 2007 9:46 PM .Net , Security , Web Tech | Back to top


Comments on this post: An Exception 'System.TypeInitializationExpection' has occurred

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Saqib Ullah | Powered by: GeeksWithBlogs.net