-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
WPF Refactoring #1: Add abstraction layer for MEF #3257
WPF Refactoring #1: Add abstraction layer for MEF #3257
Conversation
I appreciate your support. Given that most parts of the UI are 13 years old and were hacked together on a weekend, I don't see a problem with the UI-first approach. However, I agree that it's time to clean it up. I am really looking forward to having proper DI instead of static state everywhere. @christophwille what do you think? |
We looked at cleaning up the non-decompiler parts (UI) on and off over the years, and only ever managed to do minor improvements. Help definitely welcome especially around standardizing approaches, modern best practices (MEF, DI). |
6c9d20a
to
babac04
Compare
OK, I'll do some review then and now, and try to provide step by step PR's, so it's trackable what has been changed.
|
Fody is not an option. All net80 targets can use latest language features, all I know is that primary ctors are a touchy subject (like please don't use those). |
|
INPC - if base classes don't cut it, one of the current and active source generators? @siegfriedpammer or would that be a no-go? |
source generators are fine! |
If you already have a plan, surely a good idea. |
a73c09e
to
2748c91
Compare
<PackageVersion Include="coverlet.collector" Version="6.0.2" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<GlobalPackageReference Include="TomsToolbox.Composition.Analyzer" Version="2.18.1" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that really a good idea? That will then be applied to all the VSIX projects, ilspycmd, the installer, et cetera. We have fewer MEF projects than non-MEF projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GlobalPackageReferences are compile-time only by default, and this is just an analyzer helping to make consistent export definitions.
2748c91
to
8ad2561
Compare
@tom-englert please let us know when you consider this "first refactoring" ready for review / merge |
@christophwille this is a first consistent step and ready for review |
@@ -22,12 +22,15 @@ | |||
|
|||
namespace ICSharpCode.ILSpyX.Analyzers.Builtin | |||
{ | |||
using System.ComponentModel.Composition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved out of the namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
May I ask you to clean your commits up before we merge this once you are done? For example 4a933f6 and 22ad795 could be merged into one commit so that the file you added and then removed, never is visible in the commit history... Thank you very much for helping us with the UI clean up! I really appreciate it! |
@siegfriedpammer OK, I'll ping you when I completed this. |
723b4b1
to
d4df855
Compare
d4df855
to
1fe706e
Compare
@siegfriedpammer History is now cleaned up |
using System.Diagnostics; | ||
|
||
using ICSharpCode.Decompiler.TypeSystem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool, because this class was moved to ILSpyX, which does not reference WPF, we no longer have to deal with the "Accessibility.dll/namespace ambiguity" 👍
ILSpy.sln.DotSettings
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please keep third-party-tooling-specific files out of the repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this would make the life harder for anyone using ReSharper, getting false positive warnings everywhere, making it impossible to write compliant code.
Is this what you want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"make the life harder for anyone using X" where do we draw the line then on which tool is important enough for its custom configuration to go into the repo? Nobody in 10+ years ever asked for R#.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you simply keep a copy for yourself and assume it unchanged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the missing rules to .editorconfig, so that's available to everybody now, independent of the tooling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nobody in 10+ years ever asked for R#.
That's because they all use Rider now 😅
On a more serious note, I'd like to vote for being as friendly as possible towards R#/Rider users. Almost everyone at my work prefers Rider over VS, and no one uses plain VS without R# anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ltrzesniewski works now with .editorconfig instead of R#.settings, so that should be fine with Rider, too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nobody in 10+ years ever asked for R#.
That's because they all use Rider now 😅
On a more serious note, I'd like to vote for being as friendly as possible towards R#/Rider users. Almost everyone at my work prefers Rider over VS, and no one uses plain VS without R# anymore.
and nobody on the core team uses anything besides VS...
1fe706e
to
e241444
Compare
Thank you very much for the great work! |
Problem
The WPF-UI implementation is very inconsistent, e.g. often favoring the UI-first anti-pattern, with parts of the logic implemented in the UI instead of the view model.
Solution
I'd like to contribute iterative cleanup of some of the UI, starting with this PR that adds an abstraction layer to MEF, so DI can be used without a hard coded dependency to the container implementation.
This will allow to use existing tooling and maybe later update the container to some more modern implementation (e.g .Microsoft.Extensions.DependencyInjection)
Please leave some feedback here if such a cleanup is appreciated.