From e2f17c009ec9849d7ab2b7056b681523619ab552 Mon Sep 17 00:00:00 2001 From: Nikos Kastellanos Date: Sun, 12 May 2024 12:59:13 +0300 Subject: [PATCH] fix ResolveReaderType() for generics (#1558) --- .../Content/ContentTypeReaderManager.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs b/src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs index 4280012e60e..750b02aaf16 100644 --- a/src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs +++ b/src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs @@ -241,6 +241,10 @@ internal static Type ResolveReaderType(string readerTypeName) return readerType; // map XNA build-in TypeReaders + resolvedReaderTypeName = readerTypeName.Replace(", Microsoft.Xna.Framework", string.Format(", {0}", "Xna.Framework")); // e.g. "Microsoft.Xna.Framework.Content.ListReader`1[[Microsoft.Xna.Framework.Rectangle, Microsoft.Xna.Framework]] + readerType = Type.GetType(resolvedReaderTypeName); + if (readerType != null) + return readerType; resolvedReaderTypeName = readerTypeName + string.Format(", {0}", _contentGraphicsAssemblyName); readerType = Type.GetType(resolvedReaderTypeName); if (readerType != null) @@ -255,6 +259,10 @@ internal static Type ResolveReaderType(string readerTypeName) return readerType; // map MonoGame build-in TypeReaders + resolvedReaderTypeName = readerTypeName.Replace(", MonoGame.Framework", string.Format(", {0}", "Xna.Framework")); // e.g. "Microsoft.Xna.Framework.Content.ListReader`1[[Microsoft.Xna.Framework.Rectangle, MonoGame.Framework]] + readerType = Type.GetType(resolvedReaderTypeName); + if (readerType != null) + return readerType; resolvedReaderTypeName = readerTypeName.Replace(", MonoGame.Framework", string.Format(", {0}", _contentAssemblyName)); readerType = Type.GetType(resolvedReaderTypeName); if (readerType != null)