Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve .NET Native AOT failure message when missing types in rd.xml #479

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Content/ContentTypeReaderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,20 @@ internal ContentTypeReader[] LoadAssetReaders(ContentReader reader)
ex
);
}
catch (NullReferenceException ex)
{
/* If you are getting here, you are
* probably using .NET AOT and have
* an incomplete rd.xml, to aid with
* this, show a helpful exception
*/
throw new InvalidOperationException(
"Failed to get default constructor for ContentTypeReader. " +
"If you're using .NET Native AOT, ensure your rd.xml contains the following type: " +
originalReaderTypeString,
ex
);
}

needsInitialize[i] = true;

Expand Down
Loading