You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom control derived from 'System.Windows.Forms.Control' compilation error
Solution
Modify the judgment condition of 'IsWInForm' to be derived from 'System. Windows. Forms. Control' and contain a field of type 'System. Component. IContainer' with the name 'components'
1.Regarding "IsWinform"
If I only judge by whether it inherits from "System.Windows.Forms.Form", I can only compile the "Form" correctly. When I decompile the "UserControl" or "CustomControl", I will get a ".cs" file and possibly an incorrect ".resx" file. So I think the judgment should be made by whether it inherits from "System.Windows.Forms.Control" and whether it contains the "InitializeComponent" method. Regarding the property "components", I've found that it may not necessarily exist in some old projects.
For example, this is my test project.
The project after decompilation is only correct for the "Form".
After modifying the judgment conditions, I got the correct project.
2.Regarding the "xaml" type name.
The directory of XAML may not be consistent with the namespace of the XAML type. When they are inconsistent, the complete type obtained through the XAML resource name will be incorrect. The correct XAML type should be extracted from the XAML file.
For example, this is my test project. The namespace of "HomePage" is under "TestView", but the path is under "TestWpf/Views".
After decompilation, I'll get a ".cs" file and a ".xaml" file that are not related to each other.
After using the type extracted from the XAML. Although the path is not exactly the same as the original one, I obtained the correct XAML file.
3.Regarding The "LoadDependencies"
Recently, I got a job that requires me to decompile all the assemblies of an old project and restore the original code files as much as possible. This project is quite large, with around 400 assemblies. Without this add - in, I would have to click on each dependency one by one to load them. Moreover, some assemblies have common references. In this way, I might need to click thousands of times to load all the dependent projects. Additionally, I may currently receive different versions of this set of assemblies, which means I'll face a lot of repetitive operations. That's why I made this modification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workingdecompilerRelating to the C#, VB.NET, and IL decompilerenhancementNew feature or request
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue(s) this pull request covers:
Problem
Custom control derived from 'System.Windows.Forms.Control' compilation error
Solution
Modify the judgment condition of 'IsWInForm' to be derived from 'System. Windows. Forms. Control' and contain a field of type 'System. Component. IContainer' with the name 'components'