Questions tagged [unmanaged]

Unmanaged refers to Windows code that is independent of the Common Language Runtime(CLR). COM components, ActiveX components, and Win32 API functions are examples of unmanaged code.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Build error: "Cannot find project info. This can indicate a missing project reference" after migrating from NET Framework 4.0 to NET Standard 2.0

In order to migrate the C# project to NET Standard 2.0, I followed the advices here. I used the NET upgrade-assistant CLI tool to convert the legacy C# csproj file to NET Standard 2.0. This process ...
user3160108's user avatar
-1 votes
0 answers
14 views

Use a class passed by reference when the unmanaged function demands two levels of indirection. Marshalling C++ Stucts in C# [closed]

In C++ code : int32_t moduleGetInfo(moduleHandle hnd, void** info); // info Pointer to a structure with additional // information enum InfoFlags { ...
Gorsky17's user avatar
0 votes
1 answer
91 views

Marshal structure to pointer - Byte is OK, Byte() is Not OK

I am trying to get a pointer from a Structure, to pass it over to an unmanaged DLL. The weird thing is the following, if I use this Structure: Structure message Public x As Byte End Structure And ...
Manuel's user avatar
  • 623
0 votes
0 answers
29 views

How can I write an enumerator for nested unmanaged enumerables?

I've written enumerators based on the existing NativeHashMap.Enumerator and UnsafeHashMap.Enumerator structs that work in burst, but I am running into trouble when I try to combine enumerators for ...
Disciple153's user avatar
1 vote
0 answers
57 views

How to use unmanaged function in PowerShell to get all the chains in this signed file?

I have this file: https://ufile.io/1j5pleow it has 4 certificates in its path. Using this method $FilePath = '.\NordPassSetup_x86.exe' # Get the certificate from the file path $Cert = New-Object ...
SpyNet's user avatar
  • 404
0 votes
0 answers
42 views

Debug Shellcode in a Managed C# .NET Program with Visual Studio

I'm looking at this project that shows how to call unmanaged shellcode from a C# program. I want to debug and step through the shellcode but can't seem to make this happen. I can step into the ...
Mr. Anderson's user avatar
0 votes
0 answers
75 views

An error relating to security occurred - when loading the project from template Visual Studio 2022

I am trying to move the projects from one solution to another. Visual Studio 2022 was doing a good job in helping me do this until now. Here is what I had been doing Open source-solution in visual ...
Vivek Shukla's user avatar
1 vote
0 answers
220 views

SAPUI5, RAP, unmanaged and freestyle: Create entity and children with "create by association" - how to call from client code?

I want to create a header with its 2 associations in one go. My behaviour class exists, the "create" on the root entity is called properly and twerks nicely. But the passed parameter for ...
icbytes's user avatar
  • 1,829
0 votes
0 answers
85 views

In c# can you dynamically load an unmanaged DLL and also dynamically specify the function call?

I need to dynamically load an unmanaged DLL and dynamically specify the function calls and parameters. In examples I found you and methods I used in the past you statically specify the delegate in the ...
runfastman's user avatar
0 votes
0 answers
100 views

Full-Minidump does not allow me to debug the native memory part

We are running a service in a Linux container on a Kubernetes cluster. The task is to get out core dumps for debugging in case of failure. That works fine but even though everything seems to be set up ...
Foxxy's user avatar
  • 25
0 votes
1 answer
79 views

C# How to get data from the 2-Dimensional byte Array which is member of the structure

In structure, a member was declared as 2-Dimensional array which name as myData and layout to 2*3. [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct myStruct { [MarshalAs(UnmanageType....
Yves's user avatar
  • 1
0 votes
0 answers
19 views

Use functions from a c++ dll stored as a resource, from within a c# wpf file

I have a security dll which is built from unmanaged c++ code. I would like to include this in my c# wpf project as an embedded resource, rather than as a separate dll on the file system. At runtime I ...
jetbadger's user avatar
0 votes
2 answers
227 views

How to correctly pass a vector of struct from C++ to C#?

Here is my code in C++ struct myStruct { int cid; float c; float r; }; int Predict(myStruct* p, const char* path2D) { std::vector<myStruct> result = SomeFunction(path2D);//e.g., ...
sulabh's user avatar
  • 41
4 votes
1 answer
63 views

Is a C# struct with a single field equivalent to the standalone type of the field in unmanaged memory?

For example, is the unmanged memory layout of this struct: public struct MyStruct<T> where T: unmanaged { public T pointer; } the same as a plain T? Also, does they behave in the same way ...
Shanoa Ice's user avatar
0 votes
1 answer
146 views

Why is there no "managed" generic type constraint?

The "unmanaged" generic type constraint was added in c# 7.3, but I'm curious why a corresponding "managed" type constraint was not added at the same time (or since)? The unmanaged ...
Paul's user avatar
  • 27
0 votes
0 answers
29 views

#pragma unmanaged makes vc_redist a must dependency

My MSIX-packaged project uses a hand-made C++ DLL, which requires Visual C++ Runtime (vc_redist) to run, otherwise it will silently crash. I would like to allow users to run it without having to find /...
Frank Xu's user avatar
1 vote
1 answer
65 views

Delegate getting GC even after pinning?

Related code here: https://github.com/AkazaRenn/FruitLanguageSwitcher/blob/main/Core/Hotkey.cs#L17 Callback code related class: internal class Hotkey { [UnmanagedFunctionPointer(...
Frank Xu's user avatar
2 votes
1 answer
115 views

How can a C# library depend on an unmanaged DLL whose name will only be provided later in the final application?

In C you can compile a static library which depends on a C header defining several functions. You don't need to know which library will end up implementing those functions, so your static library can ...
curiousdannii's user avatar
0 votes
0 answers
26 views

Include dependent unmanaged C/C++ DLL in upper managed reference [managed C++]

I have some managed Visual C++ project which uses/links to an unmanaged DLL and serves as sort of a interop proxy between the two worlds, with some additional bells and whistles. It all works fine, ...
mmix's user avatar
  • 6,110
2 votes
2 answers
94 views

How can you fill an entire array pointer with a single value with a single write operation?

I have a pointer to a byte array, and I need to set the values of a certain region of this array to 0. I'm quite familiar with the methods available through the Marshal/Buffer/Array classes, and this ...
M3rein's user avatar
  • 197
1 vote
2 answers
553 views

mark struct as unmanaged in C# - Unity ECS Baker

I'm dealing with new ECS package (com.unity.entities) and have following code in my Monobehavior: public class LevelBaker : Baker<LevelMono> { public override void Bake(LevelMono authoring) ...
Arkadiusz Galler's user avatar
1 vote
0 answers
154 views

Enabling native debugging and pressing F12 key raises __debugbreak

In an application using OpenTK, enabling native debugging and pressing F12, the debugger breaks: A breakpoint instruction (__debugbreak() statement or a similar call) was executed in ... The call ...
aybe's user avatar
  • 15.8k
3 votes
1 answer
133 views

.Net core child processes do not inherit (socket) handles from parent process (Windows)

We implemented a Windows assembly in C#. This program is listening on a socket for incoming connections and starting child processes (unmanaged c code) which should then be using this socket. The ...
Michael's user avatar
  • 93
1 vote
1 answer
158 views

Marshal c# struct to C struct is not working

I want to call the following C function from C#, but it doesn't work. The C code is part of the .so file. In my case the code should run in an Linux environment! The C# Code is part of a console app ...
Simon's user avatar
  • 87
-3 votes
1 answer
86 views

How to expose native to managed - C++/CLI on x64 Platform

I have a static lib in my project and I want to use this in my .net project. I have taken this project as a starting point. Exposing native to managed - C++/CLI My use case is the Second Approach. So ...
Diddlik's user avatar
  • 76
1 vote
1 answer
261 views

Calling a Delphi DLL from C# - Issues

First: I read a lot of similar questions, tried a lot of different solutions, yet I couldn't achieve to work with the Delphi DLL. The Delphi DLL provides the following method: procedure FetchData(var ...
Davit's user avatar
  • 23
1 vote
1 answer
57 views

How struct size effects automatic marshaling in .NET

I am working on a C# .NET wrapper that wraps an unmanaged C++ Driver. The logic is to create a C# class that has methods which wrap the DLLImport entries. One of the functions of the unmanaged driver ...
AntGeorge's user avatar
1 vote
2 answers
126 views

strings breaking coming back from unmanaged code C++

I'm creating a wrapper for an unmanaged C++ function to be called using C#. The function returns a vector of structs. When returning from the function, the strings are all ok, but after the 'return' ...
FranciscoNabas's user avatar
2 votes
1 answer
355 views

load C# dll in c++/cli and create a dll that works in unmanaged language

I have written a selenium script in C# and now I want to expose all functions and use them all in c++ code. My point is to deliver a dll to sb who wants to use this dll in pascal (delphi). The C# code ...
AliTab's user avatar
  • 21
2 votes
1 answer
282 views

error when call the unmanaged resouce functions from c#.net core dll into vb.netcore windows application

I got Issues when I call unmanaged resource functions from C#.net core DLL into VB.net core windows application. The program execution just stops suddenly when the function is hit. Please below is my ...
Raj's user avatar
  • 21
2 votes
0 answers
114 views

Getting Managed Debugging Assistant 'FatalExecutionEngineError' when accessing unmanaged code from parallel thread

I am accessing some methods from unmanaged code dll using [DLLImport] [DllImport("Foo.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] public static extern int ...
Omc's user avatar
  • 21
-2 votes
2 answers
80 views

Make class pointer in c# store the data from cpp side

I'm writing a c# / cpp mixed program and need to call some cpp functions inside c#. For most of the functions, I can just use PInvoke approach to call extern cpp funcs. // cpp part void compute(...
X.Arthur's user avatar
  • 276
2 votes
2 answers
2k views

VS2022: Is there a faster way to toggle "Enable Native Code Debugging" setting?

I work on a solution with both managed (C#) and native (C++) code. The managed code calls into the C++. I typically have native code debugging disabled because it makes the whole experience slower ...
Joe's user avatar
  • 5,632
1 vote
1 answer
1k views

getting error while creating unmanaged node groups using eksctl in eks

Anyone please help ,I'm getting this error "Error: couldn't create cluster provider from options: nodeGroups[0].overrideBootstrapCommand is required when using a custom AMI (nodeGroups[0].ami)&...
nooka sumanth sai's user avatar
3 votes
0 answers
540 views

How to call a .NET 6 library (C#) from unmanaged code

I've been calling a C# (.NET Framework 4.61) library from MetaTrader 4 (unmanaged code) using UnmanagedCode (RGiesecke.DllExport), but I'd like to create a new project in .NET 6. Is there an ...
Dennis Gundersen's user avatar
0 votes
0 answers
115 views

When do unmanaged DLLs get unloaded when used by C# web pages?

Our web application is written in C# ASP.Net on Windows IIS. We needed to interface with a third party unmanaged DLL that can only be used from C++. I created a C++ DLL wrapper and C# wrapper around ...
Roland Smith's user avatar
2 votes
0 answers
325 views

Unable to handle exception thrown from unmanaged/native code in managed code(c# wpf) such as out of memory exceptions globally

In my windows C#.net application, using some third party libraries which are of c++. and in few cases, I am unable to catch the exceptions thrown from those c++ libraries, I have tried all the below ...
Aswini Y's user avatar
2 votes
1 answer
296 views

CS0212 Error using dll with unsafe code: You can only take the address of an unfixed expression inside of a fixed statement initializer

The (incomplete) snippet unsafe class MainWindow { ... IntPtr somePtr = IntPtr.Zero; unsafe private void Click(object sender, RoutedEventArgs e) { ...
Oblomov's user avatar
  • 9,123
0 votes
1 answer
162 views

how to reference imagesearch.dll to c# winforms?

I can't reference ImageSearch.dll in my project. I've been trying for days and can't get any further. it seems to me that i'm the only one with this problem and i don't know what to do next. Is it ...
user avatar
0 votes
0 answers
184 views

Marshalling const std::string parameters [duplicate]

When I try to import the function extern __declspec(dllexport) void SomeNativeFunction(const std::string param1, const std::string param2); defined and declared in SomeNative.Dll into a .NET ...
Oblomov's user avatar
  • 9,123
0 votes
1 answer
300 views

Debugging XP SP2/SP3 native application symbol path issue

When I tried to validate, if WinDbg has been setup properly, I opened the executable C:\WINDOWS\NOTEPAD.exe and tried to check the loaded modules. First of all, these are the environment variables set:...
kvirk's user avatar
  • 117
0 votes
0 answers
78 views

Visual Studio/CLR: Is it possible to watch an unmanaged pointer's attributes?

COMMON LANGUAGE RUNTIME Is there any way to "watch" - see the member variables/values - an unmanaged pointer in a Visual Studio debug watch window in a VB.NET <=> Managed C++ <=> ...
Stephen Baldwin's user avatar
1 vote
0 answers
273 views

SecurityException when running sandbox code in C#

I am following the example code from this page to create a sandbox application that launches Windows executable files with limited permissions: https://learn.microsoft.com/en-us/previous-versions/...
brandr2's user avatar
  • 11
0 votes
0 answers
88 views

Pass a char * to Unmanaged C | Best Practice

This may be a duplicate. I've looked at some of the other answers, but I don't think they fit my problem exactly. I have a large VB.NET structure which I have been successfully marshaling and passing ...
Stephen Baldwin's user avatar
1 vote
0 answers
143 views

Is it possible to have in SBT a Test Fixture source folder?

Reading the following SBT documentation: https://www.scala-sbt.org/1.x/docs/Appending-Values.html And also https://www.scala-sbt.org/1.x/docs/Classpaths.html I can get on how to create a test source ...
jonathan gafner's user avatar
0 votes
1 answer
304 views

How to access constant values in an unmanaged dll

I have an unmanaged dll, inside which there is a constant value as the following: #define ProtocolVersion 1 How can I access this value in C#? p.s.: I checked this post but it didn't work.
BHP's user avatar
  • 453
0 votes
0 answers
139 views

Dynamic Load Class from within an unmanaged DLL

I am trying to dynamically load classes from within an unmanaged (COM) DLL. I am not sure the language it was written in, it is 3rd party that does not exist anymore. I am able to use NativeLibrary....
Chris Calvert's user avatar
-1 votes
1 answer
333 views

How do I implement an interface from COM in C#

[NOT A DUPLICATE, I've searched for solutions for days and had performed a lot of tests only to find nothing really helps. That's why I registered stackoverflow and posted this.] [SITUATION] I am ...
Qiu's user avatar
  • 1
1 vote
1 answer
240 views

Does .NET initialize struct padding to zero?

When .NET initializes a struct to zero, does it zero out the padding as well? I ask because I'm wondering about the limitations of doing bitwise comparisons on unmanaged structs. Note how ...
Timo's user avatar
  • 8,180
0 votes
0 answers
70 views

How to pass data from VB.net to C++ and vice versa?

I am doing an application that has a UI made by VB.net. The VB.net collects all user input data, and I need to pass it to unmanaged C++ to process the data. My current approach is to save the data ...
N.T.C's user avatar
  • 658

1
2 3 4 5
30