---
title: "Solving System.TypeInitializationException when running the Regulator"
url: "https://osherove.com/blog/2004/9/3/solving-systemtypeinitializationexception-when-running-the-r.md"
canonical: "https://osherove.com/blog/2004/9/3/solving-systemtypeinitializationexception-when-running-the-r.html"
published: "2004-09-03T19:20:00"
updated: "2004-09-03T19:20:00"
tags: ["Tips & Tricks"]
author: "Roy Osherove"
description: "I've recently started to get emails from people who had The Regulator break on their system after installing SP2 (or some other hotfix...). I'm not sure exactly how it broke, but I know how to fix it. Here's a typical…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Solving System.TypeInitializationException when running the Regulator

By Roy Osherove September 3, 2004 In [Tips & Tricks](https://osherove.com/blog/category/tips-tricks)

**Historical article** · Originally published September 3, 2004; technical details may be outdated.

I've recently started to get emails from people who had [The Regulator](http://regulator.sourceforge.com/) break on their system after installing SP2 (or some other hotfix...). I'm not sure exactly how it broke, but I know how to fix it.

Here's a typical email and the solution is in the end:

"_I have been using your Regulator utility for some time and now all of a sudden I'm getting the following error:_

An unhandled exception of type 'System.TypeInitializationException' occurred in Regulator.exe

Additional information: The type initializer for "Regulator.SDK.AppContext" threw an exception.

_I'm assuming XP SP2 has something to do with this but I'm not 100% certain because a couple colleagues are also using it with SP2 installed with no ill effects._

_I noticed that Net Framework 1.1 SP1 was out yesterday, but I haven't thrown that on yet. Think I'll wait a while._

_BTW, I tried a repair and also an uninstall/reinstall, with the same error cropping up each time. Any ideas?"_

**The solution:**

Install The Regulator again but to a **different** folder.That should fix it.

The plugin configuration file was messed up and the application can't read it and load the plugins. Re-installing it to a different folder also creates the config file again. Repair will not touch existing config files for some reason.

## More in Tips & Tricks

[All posts in Tips & Tricks](https://osherove.com/blog/category/tips-tricks)

- Dec 31, 2004

    ### [Manage many events easily with EventHandlerList](https://osherove.com/blog/2004/12/31/manage-many-events-easily-with-eventhandlerlist.html)

- Dec 7, 2004

    ### [Small but useful SQL tips from SQLJunkies](https://osherove.com/blog/2004/12/7/small-but-useful-sql-tips-from-sqljunkies.html)

- Sep 3, 2004

    ### [attach a debugger to a service automatically at startup](https://osherove.com/blog/2004/9/3/attach-a-debugger-to-a-service-automatically-at-startup.html)

- Jul 24, 2004

    ### [\[Tip\] how to get Windows Explorer to "Yes to All" or "No to All":](https://osherove.com/blog/2004/7/24/tip-how-to-get-windows-explorer-to-quotyes-to-allquot-or-quo.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
