1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

Rethrow exceptions when no RawContentManager readers could be constructed

This commit is contained in:
Ell 2022-01-02 22:49:39 +01:00
parent 29bbd61f8b
commit b2b34abcd0
2 changed files with 9 additions and 2 deletions

View file

@ -21,6 +21,10 @@ Improvements
Improvements Improvements
- Allow for checkboxes and radio buttons to be disabled - Allow for checkboxes and radio buttons to be disabled
### MLEM.Data
Improvements
- Rethrow exceptions when no RawContentManager readers could be constructed
## 5.2.0 ## 5.2.0
### MLEM ### MLEM
Additions Additions

View file

@ -99,6 +99,7 @@ namespace MLEM.Data.Content {
private static List<RawContentReader> CollectContentReaders() { private static List<RawContentReader> CollectContentReaders() {
var ret = new List<RawContentReader>(); var ret = new List<RawContentReader>();
var assemblyExceptions = new List<Exception>();
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
try { try {
if (assembly.IsDynamic) if (assembly.IsDynamic)
@ -114,10 +115,12 @@ namespace MLEM.Data.Content {
throw new NotSupportedException($"The type {type} cannot be constructed by a RawContentManager. Does it have a visible parameterless constructor?", e); throw new NotSupportedException($"The type {type} cannot be constructed by a RawContentManager. Does it have a visible parameterless constructor?", e);
} }
} }
} catch { } catch (Exception e) {
// ignored assemblyExceptions.Add(e);
} }
} }
if (ret.Count <= 0)
throw new AggregateException("Failed to construct any RawContentReader instances", assemblyExceptions);
return ret; return ret;
} }