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

Display struct field offset on C# Quick Info #239

Closed
O-n-y opened this issue Dec 18, 2022 · 2 comments
Closed

Display struct field offset on C# Quick Info #239

O-n-y opened this issue Dec 18, 2022 · 2 comments
Labels
>_<! under consideration of dropping... feature request QuickInfo Tool tip and quick info

Comments

@O-n-y
Copy link

O-n-y commented Dec 18, 2022

	[StructLayout(LayoutKind.Sequential, Pack = 1)]
	public struct SomeStructRecord
	{
		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
		private ulong[] Pad;
		public IntPtr PrevPtr;
		public IntPtr NextPtr;
		public uint Id;
		private uint _unk1;
      }

Can you please add to the tooltip information about struct member offset?

for example, when I put the cursor under NextPtr it should show me in the tooltip the offset 0x10

@wmjordan wmjordan added feature request QuickInfo Tool tip and quick info labels Dec 19, 2022
@wmjordan wmjordan changed the title [Feature Request] Display struct field offset on C# Quick Info Dec 19, 2022
@Decimation
Copy link

This information can be retrieved from symbol files. See my comment here. Maybe merge with #231 and the class explorer?

@wmjordan
Copy link
Owner

wmjordan commented Feb 4, 2023

This information can be retrieved from symbol files

Usually it might not be the way to go.
When we work with source code files, there's no pdb, dll or any kind of symbol files.
We have to calculate the layout by the given literal code lines.

Unfortunately the layout may be various according to CLRs.

That is why we usually calculate field offsets at runtime.
The typical algorithm is can be read in the TypeInspector of the ObjectLayoutInspector project.

@wmjordan wmjordan added the >_<! under consideration of dropping... label Feb 4, 2023
@wmjordan wmjordan closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>_<! under consideration of dropping... feature request QuickInfo Tool tip and quick info
Projects
None yet
Development

No branches or pull requests

3 participants