Skip to content

Conversation

@lextm
Copy link
Contributor

@lextm lextm commented Dec 17, 2025

Typical changes needed by the cross platform port are,

  1. A trivial namespace rename (TextView was both a control name and a namespace).
  2. A few types were moved to their own source files, either easy to be replaced in the cross platform project folder, or add as link.
  3. Split a few key classes into multiple source files, so that their WPF specific parts can be easily replaced in the cross platform project.

Still a work-in-progress, but should be ready to review and merge as it doesn't change anything fundamental on the WPF side.

@christophwille
Copy link
Member

Why that moving around? namespace ICSharpCode.ILSpy.TextView => namespace ICSharpCode.ILSpy.TextViewControl

@lextm
Copy link
Contributor Author

lextm commented Dec 17, 2025

Project Rover uses two compiler tricks to enable source file reuse without heavy modifications,

However, such tricks fail easily when a type has the same name as an existing namespace. The term TextView happens to be hitting this problem.

I will see how much effort it takes to avoid this namespace change though. Will provide an update once I have some results.

@lextm
Copy link
Contributor Author

lextm commented Dec 17, 2025

Reverted the namespace changes, but one more extra file to maintain in the cross platform port.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the ILSpy codebase to support cross-platform porting by separating WPF-specific code from platform-independent logic. The refactoring maintains existing functionality while restructuring code to enable easier platform abstraction.

Key Changes

  • Split multiple classes into platform-specific (.wpf.cs) and shared (.cs) files to isolate WPF dependencies
  • Extracted nested classes and extension methods into separate files for better modularity and platform-specific replacement
  • Added IList interface implementation to SharpTreeNodeCollection for cross-platform binding compatibility

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
ILSpy/Views/OpenFromGacDialog.xaml.cs Removed nested GacEntry class (extracted to separate file) and unused using statement
ILSpy/Views/GacEntry.cs New file containing extracted GacEntry class nested within OpenFromGacDialog partial class
ILSpy/ViewModels/TabPageModelExtensions.wpf.cs New file with WPF-specific Focus extension method for TabPageModel
ILSpy/ViewModels/TabPageModelExtensions.cs New file with platform-independent TabPageModel extension methods
ILSpy/ViewModels/TabPageModel.cs Removed TabPageModelExtensions static class (extracted to separate files) and unused using statements
ILSpy/ViewModels/PaneModel.cs Removed Pane static class with WPF dependency properties (extracted to separate file) and unused using statement
ILSpy/ViewModels/Pane.cs New file containing extracted Pane static class with WPF dependency properties
ILSpy/ViewModels/LegacyToolPaneModel.cs Removed unused System.Windows using statement
ILSpy/ViewModels/DebugStepsPaneModel.cs Removed unused System.Windows using statement
ILSpy/TreeNodes/AssemblyListTreeNode.wpf.cs New file with WPF-specific drag-drop implementation for AssemblyListTreeNode
ILSpy/TreeNodes/AssemblyListTreeNode.cs Made class partial, removed drag-drop methods (moved to .wpf.cs file) and unused using statements
ILSpy/TextView/VisualLineReferenceText.wpf.cs New file with WPF-specific cursor handling for VisualLineReferenceText
ILSpy/TextView/VisualLineReferenceText.cs New file with platform-independent VisualLineReferenceText implementation
ILSpy/TextView/ViewState.cs New file containing extracted ViewState class from DecompilerTextView
ILSpy/TextView/ReferenceElementGenerator.cs Removed nested VisualLineReferenceText class (extracted to separate files)
ILSpy/TextView/IBracketSearcher.cs New file containing extracted IBracketSearcher interface
ILSpy/TextView/DefaultBracketSearcher.cs New file containing extracted DefaultBracketSearcher class
ILSpy/TextView/DecompilerTextView.cs Removed ViewState class (extracted to separate file)
ILSpy/TextView/BracketSearchResult.cs New file containing extracted BracketSearchResult class
ILSpy/TextView/BracketHighlightRenderer.cs Removed bracket-related classes (extracted to separate files) and added null-safety for resource loading
ILSpy/SmartTextOutputExtensions.cs New file containing extracted SmartTextOutputExtensions static class
ILSpy/Search/ShowSearchCommand.cs New file containing extracted ShowSearchCommand class with debug logging
ILSpy/Search/SearchPaneModel.cs Added [Export] attribute and made class partial
ILSpy/Search/SearchPane.xaml.cs Removed ShowSearchCommand class (extracted to separate file) and unused using statement
ILSpy/Options/DisplaySettings.cs Added CROSS_PLATFORM conditional compilation for font handling
ILSpy/Languages/CSharpLanguage.wpf.cs New file with WPF-specific AddWarningMessage implementation
ILSpy/Languages/CSharpLanguage.cs Made class partial and removed AddWarningMessage method (moved to .wpf.cs file)
ILSpy/ISmartTextOutput.cs Removed SmartTextOutputExtensions class (extracted to separate file) and unused using statements
ILSpy/Docking/DockWorkspace.wpf.cs New file with WPF-specific docking and layout management implementation
ILSpy/Docking/DockWorkspace.cs Made class partial, changed Export attribute to explicit type, removed WPF-specific methods and using statements
ILSpy/AssemblyTree/AssemblyTreeModel.wpf.cs New file with WPF-specific constructor and initialization logic
ILSpy/AssemblyTree/AssemblyTreeModel.cs Made class partial, removed constructor and LoadInitialAssemblies method, added TODO comments
ILSpy/AboutPage.cs Added CROSS_PLATFORM conditional compilation for binding and image loading
ICSharpCode.ILSpyX/TreeView/SharpTreeNodeCollection.cs Added IList interface implementation with collection manipulation methods
ICSharpCode.ILSpyX/TreeView/SharpTreeNode.cs Added ViewChildren property and LoadingTreeNode class for cross-platform tree view binding

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@christophwille
Copy link
Member

Fyi, we run Copilot reviews on almost all PRs these days to see how it changes over time (quality-wise), so expect nuggets and duds.

@lextm
Copy link
Contributor Author

lextm commented Dec 18, 2025

@christophwille It actually provides some useful insights. I am still working on the repo reconfiguration, so will take care of them later.

@christophwille
Copy link
Member

No need to rush anything. A well-thought-out & tested approach is appreciated.

@lextm lextm force-pushed the wpf-isolation branch 3 times, most recently from d571676 to 175fd60 Compare December 31, 2025 04:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 55 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants