When trying to locate a Type (typically a class) at runtime, if the name passed to the
Type.GetType(string typeName, bool throwOnError = True)
overload cannot be located, the exception raised is TypeLoadException.
I understand that the thinking behind this is that the CLR believes that the problem is that we have not (yet) loaded the (or any) Assembly that contains the Type sought, but the way I think of it is that the problem is that the CLR cannot find the class given its name. (The name may have been mis-spelled, of course.)
It seems that I have two choices if I want to tell the clients of my Reflection-oriented define-code-at-runtime tool that the class they asked for wasn't found -- either tell them with TypeLoadException, or define my own ClassNotFoundException.
I found this link that gives (apparently good and certainly complete) information on creating custom Exception classes (in C#), but that's quite a lot of work for (properly implementing) such a simple idea.
It appears that I'll also want to build something that knows the Assembly names of common classes (or their namespaces) that I think my clients might want to use, so that I can load the proper Assembly if/when my user asks for a class that's in a somewhat-well-known but not-yet-loaded Assembly. This also seems to be a feechur that the BCL might well have provided for us. (I suppose that's what the AppDomain.TypeResolve event is for, but I'm going to ask a separate question to try to locate an easily-reusable and -extendable implementation of that concept.)
Meanwhile, I'll ask again -- why isn't ClassNotFoundException already defined?