The type caught or thrown must be derived from System.Exception

Today I received a random error, the error message read “The type caught or thrown must be derived from System.Exception”. The reason why this was to me a random error was because I was trying to catch a Microsoft.TeamFoundation.WorkItemTracking.Client.ServerRejectedChangesException exception.


To try see if maybe this was a bug or maybe my pc needed a reboot or something I started drilling into the definitions of the exception to try get all the way through to System.Exception.

basically this looked like below

public class ServerRejectedChangesException : ValidationException


public class ValidationException : ClientException


public class ClientException : TeamFoundationServerException


public class TeamFoundationServerException : Microsoft.VisualStudio.Services.Common.VssException

At the TeamFoundationServerException class I noticed that the VssException was not lit up by Visual Studio which to me meant that I didn’t have a reference added to be able to drill into it’s definition like I was for the previous levels.

I added a reference to Microsoft.VisualStudio.Services.Common and suddenly the error been thrown when trying to build my project went away. Basically this allowed the IDE to navigate through to System.Exception like below.

public abstract class VssException : ApplicationException


public class ApplicationException : Exception


public class Exception : ISerializable, _Exception

It would be cool if this extra reference was not needed but I understand why it is Smile.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s