English 中文(简体)
NetFx40_PInvokeStackResackilience dont似乎在工作
原标题:NetFx40_PInvokeStackResilience doesnt seem to work

I have a library I am trying to use with a Dot Net 4 App in C#. This is a binaray runtime so I dont have access to the library source. I am getting the error

A call to PInvoke function XXXXXXXXXXX.WinAPI::GetDCEx has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

如果我不同意PInvokeStackImbalance MDA的申请,是因为该申请不再被夸大。 虽然这围绕着申请问题,但显然存在问题。

I recently read about NetFx40_PInvokeStackResilience an element you can place in the app.config which tells the runtime to use a marshaling layer to detect and fix incorrect platform invoke declarations (like in previous .Net versions).

<configuration>
  <runtime>
    <NetFx40_PInvokeStackResilience enabled="1" />
  </runtime>
  .....
</configuration>

问题在于,这似乎与变迁者有任何关系,变迁者仍然援引错误。

我的问题是,我是否仍然必须去掉PInvokeStackImbalance MDA?

我怎么能告诉大家,NetFx40_PInvokeStackResilience已经工作了,瓦沙林层正在开展工作?

PS I am using Visual Studio 2010 Express

P-4 我已致函图书馆所有人,提出可能的解决办法,修改其驱逐地等。 尽管瓦沙层应围绕这个问题,但可能要付出代价。 加上其混淆,而不是理想。 然而,与此同时,在图书馆得到更新之前,我仍然需要找到解决办法。

最佳回答

An imbalanced stack is a nasty kind of runtime problem. You tend to get away with it in the Debug build because the way a method sets up and tears down the stack frame can hide the problem with the incorrect stack pointer value. The stack pointer is restored at method exit. You ll have fewer odds for that kind of luck in the Release build. Particularly due to method inlining, it removes the stack setup/teardown code.

NET 4需要NetFx40_PInvokeStackResilience元素,因为它们优化了缝.。 这会打破在先前的释放中起作用的坏代码,使优化的因素更加分散。 它对整个方案具有全球性影响。 它是“not,意欲解脱MDA,这将掩盖一个非常真实的问题。 它只是让信息技术工作人员能够解决兼容问题。

你们可以降低风险,把pin子的号召化成一种单独的方法,这种方法只能发出呼吁。 你们必须与[MethodImpl(MethodImplOptions)脱钩。 排他性]这样,优化者就能够将其排在一边。 这种助手方法不能有任何out <>>>> 或ref 的论点,也不得退回一种结构类型的价值,在发出呼吁后不应有任何额外的代码。

显然,你希望投入尽可能多的时间来真正解决这一问题。 有些人在座,可以帮助你发表最初的C宣言,但我们可以帮助你找到他。 不发表pin语宣言,也消除了有些人在宣言中持有gues子的任何困难。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签