Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2019-01-14 13:23:16 +0300
committerMarek Safar <marek.safar@gmail.com>2019-01-14 22:38:19 +0300
commit00437dc5909ef3087ffb479a0d044e14be93c178 (patch)
tree951bf4e91e4ddcea8fb251c3c8ab2ddeaeb6f407 /mcs/class/referencesource/mscorlib/system/runtime
parent21a0053638270367d50ee3ae2022211bc5b7f226 (diff)
[corlib] Add tracking exception for not object based type hierarchies
Diffstat (limited to 'mcs/class/referencesource/mscorlib/system/runtime')
-rw-r--r--mcs/class/referencesource/mscorlib/system/runtime/serialization/formatterservices.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatterservices.cs b/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatterservices.cs
index 649231c2453..7afc853d71e 100644
--- a/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatterservices.cs
+++ b/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatterservices.cs
@@ -148,6 +148,13 @@ namespace System.Runtime.Serialization {
RuntimeType objectType = (RuntimeType)typeof(object);
for (RuntimeType t1 = parentType; t1 != objectType; t1 = (RuntimeType)t1.BaseType)
{
+#if MONO
+ // This should never happen
+ if (t1 == null) {
+ throw new InvalidOperationException($"Type '{parentType}' of type '{parentType?.GetType()}' does not derive from System.Object");
+ }
+#endif
+
if (t1.IsInterface) continue;
string t1Name = t1.Name;
for(int i=0;unique && i<parentTypeCount;i++){