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

Reorganize assembly resolution; fix error loading WindowsBase.dll #1483

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

CharliePoole
Copy link
Member

This PR fixes #1466, which is caused by loading the wrong copy of WindowsBase.dll, the copy that's part of Microsoft.NetCore.App rather than the one from Microsoft.WindowsDesktop.App.

In order to resolve it, I did a great deal of refactoring in TestAssemblyResolver. We were using four main strategies to locate assemblies in a fixed order. I've now changed the structure as follows:

  1. The strategies are now formal, using the Strategy pattern.
  2. I added some heuristics to decide on the order to apply the strategies to each test assembly. For example, if the test assembly directly references either a Windows Forms or a WPF assembly, we check the Microsoft.WindowsDesktop.App directory first.

I view this as a start. In the future, we may want to get self-diagnostic reporting of how often each strategy is used. We may want to subdivide the strategies further or add new ones. We'll almost certainly want to look at efficiency.

So I'd like to get comments on this PR about the usefulness of the new structure for those future purposes in addition to the normal review of the bug fix. I've asked @veleek to do the primary review as he has worked in this area but anyone on the @nunit team is welcome to review as well.

@CharliePoole CharliePoole requested a review from veleek September 16, 2024 23:50
@CharliePoole CharliePoole merged commit 03c865e into main Sep 17, 2024
4 checks passed
@CharliePoole CharliePoole deleted the issue-1466 branch September 17, 2024 08:35
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.

System.TypeLoadException : Could not load type 'System.Windows.IWeakEventListener' from assembly 'WindowsBase'
2 participants