Skip to content

Commit

Permalink
fix ResolveReaderType() for generics (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkast authored May 12, 2024
1 parent 1c7e738 commit e2f17c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 245 in src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs

View workflow job for this annotation

GitHub Actions / build

Unrecognized value passed to the parameter 'typeName' of method 'System.Type.GetType(String)'. It's not possible to guarantee the availability of the target type.
if (readerType != null)
return readerType;
resolvedReaderTypeName = readerTypeName + string.Format(", {0}", _contentGraphicsAssemblyName);
readerType = Type.GetType(resolvedReaderTypeName);
if (readerType != null)
Expand All @@ -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);

Check warning on line 263 in src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs

View workflow job for this annotation

GitHub Actions / build

Unrecognized value passed to the parameter 'typeName' of method 'System.Type.GetType(String)'. It's not possible to guarantee the availability of the target type.
if (readerType != null)
return readerType;
resolvedReaderTypeName = readerTypeName.Replace(", MonoGame.Framework", string.Format(", {0}", _contentAssemblyName));
readerType = Type.GetType(resolvedReaderTypeName);

Check warning on line 267 in src/Xna.Framework.Content/Content/ContentTypeReaderManager.cs

View workflow job for this annotation

GitHub Actions / build

Unrecognized value passed to the parameter 'typeName' of method 'System.Type.GetType(String)'. It's not possible to guarantee the availability of the target type.
if (readerType != null)
Expand Down

0 comments on commit e2f17c0

Please sign in to comment.