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

选择 VS x86环境,运行代码报错 对 PInvoke 函数“HandyControl!HandyControl.Tools.Interop.InteropMethods::GetWindowPlacement”的调用导致堆栈不对称。 #1444

Closed
Anonymy opened this issue Aug 3, 2023 · 4 comments

Comments

@Anonymy
Copy link

Anonymy commented Aug 3, 2023

Describe the bug

VS .NET 4.5 4.6环境 ,V3.4.0版本、最新master分支代码,生成选择x86环境运行代码报错:
对 PInvoke 函数“HandyControl!HandyControl.Tools.Interop.InteropMethods::GetWindowPlacement”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。

VS .NET6环境运行没有上述问题,master分支看记录有解决这个问题,似乎没有彻底解决。请作者再看看~

Steps to reproduce the bug

VS .NET 4.5 4.6环境 ,V3.4.0版本、最新master分支代码,生成选择x86环境运行代码报错:

Expected behavior

No response

Screenshots

No response

NuGet package version

HandyControl 3.4.0

IDE

Visual Studio 2019

Framework type

.Net Framework 4.5.0

Windows version

No response

Additional context

No response

@nickmxtsky
Copy link

我修改了三处
[Serializable] <-1--添加
[StructLayout(LayoutKind.Sequential)]
internal struct WINDOWPLACEMENT

2--->加了个ref

private static extern bool GetWindowPlacement(IntPtr hwnd, ref InteropValues.WINDOWPLACEMENT lpwndpl);

3--->加了个ref
if (GetWindowPlacement(hwnd, ref wINDOWPLACEMENT))

rebuild后不会报错了
环境,vs2019,
之前直接运行不会报错,但在vs2019中debug运行就会报此错误,如上修改后运行正常

@Sky-shang
Copy link

3.4.0版本有这个问题。换成3.3.0版本就没有这个问题了。
issue

@asine
Copy link
Contributor

asine commented Oct 4, 2023

我也遇到这个问题,我提交了一个解决办法,可以测试一下。 #1419

@NaBian
Copy link
Member

NaBian commented Mar 7, 2024

dc50859

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

No branches or pull requests

5 participants