fix: ignore assemblies where GetTypes() throws an exception#628
fix: ignore assemblies where GetTypes() throws an exception#628
GetTypes() throws an exception#628Conversation
E.g. `PresentationCore`
There was a problem hiding this comment.
Pull Request Overview
This PR modifies framework detection to skip assemblies that throw ReflectionTypeLoadException and updates the fallback behavior to return null when no adapter is found.
- Changed
DetectFrameworksignature to return nullable and updated its fallback from a concrete adapter tonull - Wrapped the assembly scanning loop in a
try/catchto ignoreReflectionTypeLoadException - Updated the unit test to expect
nullinstead of the fallback adapter
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Tests/aweXpect.Core.Tests/Core/Initialization/AweXpectInitializationTests.cs | Updated test to assert null result instead of fallback |
| Source/aweXpect.Core/Core/Initialization/AweXpectInitialization.cs | Made DetectFramework nullable, added exception handling, and adjusted the final fallback in Initialize() |
Comments suppressed due to low confidence (1)
Tests/aweXpect.Core.Tests/Core/Initialization/AweXpectInitializationTests.cs:11
- Add a unit test that simulates an assembly throwing
ReflectionTypeLoadExceptionto verify it is skipped and does not break the initialization sequence.
public async Task DetectFramework_WhenAllFrameworksAreNotAvailable_ShouldReturnNull()
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
98b7579 to
a8c334f
Compare
👽 Mutation ResultsaweXpectDetails
The final mutation score is NaN%Coverage Thresholds: high:80 low:60 break:0aweXpect.CoreDetails
The final mutation score is 62.50%Coverage Thresholds: high:80 low:60 break:0 |
|
🚀 Benchmark ResultsDetails
|
…)` throws an exception (#628) by Valentin Breuß
…)` throws an exception (#628) by Valentin Breuß
|
This is addressed in release v2.15.1. |



This PR modifies framework detection to skip assemblies that throw a
ReflectionTypeLoadExceptionand updates the fallback behavior to returnnullwhen no adapter is found.Changed
DetectFrameworksignature to return nullable and updated its fallback from a concrete adapter to nullWrapped the assembly scanning loop in a try/catch to ignore
ReflectionTypeLoadExceptionUpdated the unit test to expect
nullinstead of the fallback adapter