Don't throw when loading expressions wrongly marked as constants. Fixes #4105
[mono.git] / mcs / mcs / constant.cs
index 86250a222af1e33e389e8ae965ccd93b1eee5707..beb9512e6e5a5b7e31e432333e0b5fd8ff16e7ca 100644 (file)
@@ -160,8 +160,11 @@ namespace Mono.CSharp {
                                        return new NullConstant (t, loc);
                        }
 
-                       throw new InternalErrorException ("Constant value `{0}' has unexpected underlying type `{1}'",
-                               v, TypeManager.CSharpName (t));
+#if STATIC
+                       throw new InternalErrorException ("Constant value `{0}' has unexpected underlying type `{1}'", v, t.GetSignatureForError ());
+#else
+                       return null;
+#endif
                }
 
                public override Expression CreateExpressionTree (ResolveContext ec)