Questions tagged [unmanagedresources]
67 questions
0
votes
1 answer
C# objects not going out of scope and crashing the system
I have run into a strange situation where when I reassign an object variable to a new instance eventually over several iterations I appear to run out of memory. I get the error:
An unhandled exception of type "System.ComponentModel.Win32Exception"…

S Rich
- 1
- 1
0
votes
1 answer
Using `SafeHandle` for a C API, that includes reference counting
I am working on Python interop. Internally, Python keeps reference counters for all objects via Py_IncRef and Py_DecRef. I want to ensure proper finalization of pointers to Python objects, so I am trying to create a class PyHandle derived from…

LOST
- 2,956
- 3
- 25
- 40
0
votes
0 answers
Effectively release unmanaged resources when process is killed
I have multiple processes (or rather multiple instances of a process) trying to (create or) access a single memory-mapped-file. I'm using Mutex to synchronize (first) creation of mmap file.
When all the processes run the first time, it works well…

ambuj
- 121
- 1
- 8
0
votes
3 answers
Dotnet not calling its finalizer even if the object goes out of scope. How to release unmanaged resources then?
I tried with the following code
[DllImport("Core.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CreateNode();
[DllImport("Core.dll", CharSet = CharSet.Ansi, CallingConvention =…

S.Frank Richarrd
- 488
- 1
- 3
- 15
0
votes
0 answers
MVC 5 referencing unmanaged dll
I am struggling with an issue and am utterly lost as to the correct approach to handle the problem.
I have an MVC 5 application running on Windows Server 2008 R2 that communicates with an accounting package (Exchequer) via an unmanaged COM dll. As I…

Nick Adkinson
- 1
- 1
0
votes
1 answer
How to handle exception created by an unmanaged code block
In my code i am running an exe file through a process call.
How to handle exception generated by the exe file.
Can someone please help.

Deviprasad Das
- 4,203
- 7
- 36
- 51
0
votes
0 answers
Ways of holding an unmanaged resource for the lifetime of the session
Most implementations i've seen containing unmanaged resources end within a method's scope. I'm looking for ways to hold such a resource indefinitely and dispose it as the program stops running. An example of a resource which would quite possibly…

Samuel Jenks
- 1,137
- 4
- 21
- 34
0
votes
2 answers
How to release all resources for a process?
I am running a process, which is creating a file and using that file.
After the end of that process, i am deleting that file.
If some exception arises in between then how to know that the file is released by the process or not and how to delete it…

Deviprasad Das
- 4,203
- 7
- 36
- 51
0
votes
1 answer
C++/CLI array of unmanaged type passed as pointer
My question carries forward the issue from
cli/C++ how to define cli::array with unmanaged type element?
I understand that to create a managed array with an unmanaged type, I need to supply its pointer so.
array^ args=gcnew…

Krishter
- 489
- 8
- 24
0
votes
0 answers
ADODB objects are unmanaged resource?
I create ADODB recordset, command etc in my winform app and was wondering if I should implement IDisposable on their wrapper classes to free them. Are they unmanaged resources?
And to release any unmanaged resource, should call the…

nishitha nair
- 163
- 4
- 14
0
votes
1 answer
How to find out if the object a handle pointing to is already disposed in C#?
I have been working on the codes to safely and efficiently dispose unmanaged objects in C#. This is a Bitmap object created with an image. I like to track the handle to find out the status of image in memory before and after calling Dispose(). Is…

Eric
- 1
0
votes
1 answer
Memory Leaks while calling C++ dll from C#
I have a C++ dll that I am calling from C# code.
the dll takes in couple params and returns an int..
C++ code.
extern "C" __declspec(dllexport) int DoSomething(char* input1, char* buffer)
{
gss_buffer_desc token;
std::string encodedTokenStr…

Rasm
- 23
- 5
0
votes
1 answer
Reading resources from an un-managed dll with C#
I've written a command-line tool in C# which swaps out a resource in a .resources file for an alternative one. It uses ResourceReader and ResourceWriter.
I'd like to do the same thing for dll files, but I can't find a way of doing this. I tried…

El Presidente
- 43
- 1
- 6
0
votes
1 answer
Asp.net c# File is used by another process
i am using Programming language C# asp.net 4.0. I have a situation where i upload an excel. Save it on hard drive using code then using SqlBulkCopy i dump all the content of this excel in to database. the code is working fine.
Problem arises if…

Learner
- 1,277
- 3
- 15
- 34
0
votes
0 answers
GetManifestResourceStream: EXE inside a DLL
First place, I embedded into my C# project an unmanaged EXE (pdftotext.exe, actually).
I wrote a method to call it using the traditional:
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream =…

argledhel
- 167
- 2
- 3
- 16