NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0155

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

An attempt was made to pass a data type that does not derive from System.Exception into a catch block. Only data types that derive from System.Exception can be passed into a catch block.

The following sample generates CS0155:

using System;
namespace x
{
   public class b
   // try the following line instead
   // public class b : Exception
   {
   }
   public class a
   {
      public static void Main()
      {
         try
         {
         }

         catch(b)   // CS0155, resolves if you derive b from Exception
         {
         }
      }
   }
}

See Also

Exception Handling Statements