Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions 1 AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@
- ([@gpetrou](https://github.com/gpetrou))
- Ehsan Iran-Nejad ([@eirannejad](https://github.com/eirannejad))
- ([@legomanww](https://github.com/legomanww))
- Effendi Soewono ([@sefgit](https://github.com/sefgit))
1 change: 1 addition & 0 deletions 1 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].

### Fixed

- Improve loader (AddReference) robustness. Ignore and print loader error and try to continue to load if possible.

## [3.0.3](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.3) - 2023-10-11

Expand Down
27 changes: 27 additions & 0 deletions 27 src/runtime/AssemblyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ internal static Type[] GetTypes(Assembly a)
catch (ReflectionTypeLoadException exc)
{
// Return all types that were successfully loaded
foreach (var item in exc.LoaderExceptions)
{
Debug.WriteLine("[pythonnet] {0}", item.Message);
}
return exc.Types.Where(x => x != null && IsExported(x)).ToArray();
}
}
Expand All @@ -425,8 +429,31 @@ internal static Type[] GetTypes(Assembly a)
}
catch (FileNotFoundException)
{
Debug.WriteLine("[pythonnet] {0} File not found", a.GetName());
return new Type[0];
}
catch (System.TypeLoadException e)
{
try
{
return a.GetTypes().Where(IsExported).ToArray();
}
catch (ReflectionTypeLoadException exc)
{
foreach (var item in exc.LoaderExceptions)
{
Debug.WriteLine("[pythonnet] {0}", item.Message);
}
// Return all types that were successfully loaded
return exc.Types.Where(x => x != null && IsExported(x)).ToArray();
}
}
catch (Exception e) // System.TypeLoadException
{
Debug.WriteLine("[pythonnet] {0} {1}", a.GetName(), e);
return new Type[0];
}

}
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.