* Check GenerateGuidForType argument for null
* Also check for RuntimeType
/// metadata then it is returned otherwise a stable guid is generated based
/// on the fully qualified name of the type.
/// </summary>
- public static Guid GenerateGuidForType(Type type) => type.GUID;
+ public static Guid GenerateGuidForType(Type type)
+ {
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+ if (!(type is RuntimeType))
+ {
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(type));
+ }
+
+ return type.GUID;
+ }
/// <summary>
/// This method generates a PROGID for the specified type. If the type has