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

Unnecessary cast #3011

Closed
CreateAndInject opened this issue Jun 15, 2023 · 5 comments
Closed

Unnecessary cast #3011

CreateAndInject opened this issue Jun 15, 2023 · 5 comments
Labels
Bug Decompiler The decompiler engine itself

Comments

@CreateAndInject
Copy link
Contributor

test.zip

FrmApendChargeInfo.InitializeComponent:

			((System.Windows.Forms.Control)(object)this.panelEx1).SuspendLayout();
			((System.ComponentModel.ISupportInitialize)this.tabControl1).BeginInit();
			((System.Windows.Forms.Control)(object)this.tabControl1).SuspendLayout();
			((System.Windows.Forms.Control)(object)this.superTabControlPanel1).SuspendLayout();
			((System.ComponentModel.ISupportInitialize)this.picCardImage).BeginInit();
			((System.Windows.Forms.Control)(object)this.superTabControlPanel4).SuspendLayout();
			((System.ComponentModel.ISupportInitialize)this.picFaceImage).BeginInit();
			((System.Windows.Forms.Control)(object)this.superTabControlPanel3).SuspendLayout();
			((System.ComponentModel.ISupportInitialize)this.picBackImage).BeginInit();
			((System.Windows.Forms.Control)(object)this.superTabControlPanel2).SuspendLayout();
			((System.ComponentModel.ISupportInitialize)this.picFrontImage).BeginInit();
			((System.Windows.Forms.Control)(object)this).SuspendLayout();

See FaceCapture.WndProc also:

  1. virtual => override
  2. System.Runtime.CompilerServices.Unsafe.As
@CreateAndInject CreateAndInject added Bug Decompiler The decompiler engine itself labels Jun 15, 2023
@dgrunwald
Copy link
Member

Do you have the necessary reference assemblies loaded?
If they are not loaded, then the decompiler does not know that TabControl is derived from Control, so it has to use an explicit cast instead of an implicit conversion.

@CreateAndInject
Copy link
Contributor Author

CreateAndInject commented Jun 15, 2023

@dgrunwald @siegfriedpammer Yes, reference assembly is loaded, see test.zip
I think this issue is:
.exe is .NET 4, and DevComponents.DotNetBar2.dll is .NET 2.0, when we use a control defined in DevComponents.DotNetBar2.dll, ILSpy make mistakes

@dgrunwald
Copy link
Member

If you are decompiling a .NET 2.0 dll, you ideally need .NET 2.0 reference assemblies loaded.
The target framework of the overall .exe does not matter in this case.

@CreateAndInject
Copy link
Contributor Author

If you are decompiling a .NET 2.0 dll, you ideally need .NET 2.0 reference assemblies loaded. The target framework of the overall .exe does not matter in this case.

No, I'm not decompiling a .NET 2.0 dll, I'm decompiling a .NET 4.0 exe, and this exe references both 2.0 and 4.0 dlls

@siegfriedpammer
Copy link
Member

Fixed by ac0ef8a

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

3 participants