unmanagedresources

C# getting version of unmanaged dll

依然范特西╮ 提交于 2020-02-24 13:51:30
问题 I'm calling an unmanaged dll from my managed c# code and wanted to check I'm calling the right version. The code I'm trying to load the assembly (to then get the resource file and then get the version) is: cur_version = Assembly.LoadFile("X:\Workspace\yreceipts_pos\yRprintProcessor\Debug\yRprintProcessor.dll"); It's failing because of this error: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018) Does anyone know how to get around this or have a

C# getting version of unmanaged dll

点点圈 提交于 2020-02-24 13:51:10
问题 I'm calling an unmanaged dll from my managed c# code and wanted to check I'm calling the right version. The code I'm trying to load the assembly (to then get the resource file and then get the version) is: cur_version = Assembly.LoadFile("X:\Workspace\yreceipts_pos\yRprintProcessor\Debug\yRprintProcessor.dll"); It's failing because of this error: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018) Does anyone know how to get around this or have a

Application exiting with an exit code of -1073740771

家住魔仙堡 提交于 2020-01-13 10:10:32
问题 I have a WPF application, which sometimes is exiting with an exit code of -1073740771. The issue is not occurring in any pattern and it's varying from system to system. In some system the issue is occurring for less that 10% of the total cases and in other system I am seeing it occurring at a rate of almost 30% of the total cases. I haven't been able to form any solid repro steps and it seems to be happening at random. The symptoms include that after I have clicked the close button, the

Killing external process when application dies

一个人想着一个人 提交于 2019-12-11 15:07:28
问题 I've been working on a small piece that calls an external executable (ffmpeg in my case) And then I wrote a test and used test runner in a debug mode, now if I stop debugging (terminate) it still runs ffmpeg. I tried to kill the process in the finalizer and with IDisposable - it still runs. How can I make sure that the process never will be left like that, and if the caller dies or fails or gets stopped by any means, the ffmpeg executable guaranteed to be killed. I run the process as usual

Wpf managed resources cleanup

◇◆丶佛笑我妖孽 提交于 2019-12-11 13:38:33
问题 I'm trying to find a good way of cleaning up unmanaged resources that my custom controls may generate. The scenario is in which the parent window opens a child window that has a custom control with unmanaged resources (see code below). These resources need to be cleaned up when the CustomControl is no longer in use, i.e when the tree it is within is unloaded (i.e the child window closes), or it is removed from a tree (i.e it itself is unloaded) Method 1 : Unloaded event This gets triggered

Should Marshal.FreeHGlobal be placed in a finally block to ensure resources are disposed?

自闭症网瘾萝莉.ら 提交于 2019-11-29 21:13:49
问题 I have the following block of code: IntPtr unmanagedPointer = Marshal.AllocHGlobal(buffer.Length); Marshal.Copy(buffer, 0, unmanagedPointer, buffer.Length); SomeCommandThatCanThrowAnException(); Marshal.FreeHGlobal(unmanagedPointer); Should the block be wrapped in a try, and the FreeHGlobal command be placed in a finally block. (In case the middle command throws an exception). It seems to make sense that finally would prevent memory leaks in this case, however from examples that I have found