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

Mapster.Tool catch ReflectionTypeLoadException #544

Merged
merged 1 commit into from
Feb 21, 2023
Merged

Mapster.Tool catch ReflectionTypeLoadException #544

merged 1 commit into from
Feb 21, 2023

Conversation

EniacMlezi
Copy link
Contributor

@EniacMlezi EniacMlezi commented Feb 14, 2023

Was running into Mapster.Tool reflection issues. Docker debug builds (Fastmode enabled, windows build) were succeeding, but release builds (Fastmode disabled, linux build) were failing. Don't know exactly why ReflectionTypeLoadException was occuring when loading certain types from an Assembly, but mr Jon Skeet gave a beautiful (/s) piece of code to filter these exceptions out and continue with all types that loaded successfully: https://stackoverflow.com/a/7889272.

I'm afraid this also might filter out IRegister Types, but I'm not too familiar with the way Assembly.Load() and .GetTypes() work.

Possibly fixes:
#368
#467
#455
#513


namespace Mapster.Utils
{
static class Extensions
public static class Extensions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this public to use from Mapster and Mapster.Tool. Maybe not ideal if it gets published?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me to be honest, nothing problematic being exposed in that class.

@andrerav andrerav merged commit 91f7793 into MapsterMapper:development Feb 21, 2023
@andrerav
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants