Up
Up
Explore posts from servers
CC#
Created by Up on 8/11/2023 in #help
✅ EF Core Relations don't seem to work properly
I'm trying to model a fairly complex set of relations in EntityFramework core / ASP.NET, but am failing to create a new entry as the system insists it already exists; yet the corresponding table in the DB is empty
43 replies
CC#
Created by Up on 8/21/2022 in #help
ASP.NET MVC Legacy Route Hell
So I have a very old API that was originally written in MVC. this api manages projects where each project has an ID + user-friendly slug, and then has a bunch of files that each have file name + file ID. now I have an MVC route mapping that I will need to know how it resolves, so I can then extract those properties from the URL back to my own application.
4 replies
CC#
Created by Up on 8/14/2022 in #help
C++ Interop - writing a shim to use an existing c++ library [Answered]
So I'm currently trying to make a shim for a C++ library that I can then call from C#. The original library uses CMake, not MSBuild, so I've set up Cmake, let it generate the .vcxproj files, made a 2nd C++ project for my shim classes and made it depend on the generated projects. Then I've added that + the generated projects into my C# msbuild solution. Now I am trying to call a hello world function that I made in my shim library form C#, but that immediately fails with no indicator as to what went wrong. all I get is System.Runtime.InteropServices.SEHException: 'External component has thrown an exception.'. How I declared it on the C++ side:
extern "C" {
void __declspec(dllexport) __stdcall CLIP_Hello();
}
extern "C" {
void __declspec(dllexport) __stdcall CLIP_Hello();
}
How I declared it on the C# side:
[DllImport("ClipShim", EntryPoint = "CLIP_Hello", CallingConvention = CallingConvention.StdCall)]
public static extern void Hello();
[DllImport("ClipShim", EntryPoint = "CLIP_Hello", CallingConvention = CallingConvention.StdCall)]
public static extern void Hello();
any help appreciated!
101 replies