3,954 questions
-1
votes
1
answer
61
views
Publish VS project fails on System.Net.Http 4.2.0.0 not found in SQL Server even though other projects use it
I have several Visual Studio projects (Stored Procedures) that have been published to SQL Server 2014 (yes old I know - legacy software) that use System.Net.Http v4.2.0.0 so I know that the assembly ...
2
votes
2
answers
98
views
how is the ref-safe-context determined in c# when ref assigning to local variables
I am a beginner in C# trying to figure out how ref-safe-context is defined in C#. I declared a function Foo which didn't work since it tries to ref assign a variable with declaration-block to a ref ...
-1
votes
1
answer
64
views
Linking Managed C++/CLR lib to a C++/CLR dll
I was looking through references but could not find the proper solution.
Basically I am planning to have a Managed CLR/C++ DLL (which has winforms, etc). Now to function it it needs to refer to ...
2
votes
0
answers
93
views
300ms Delay Loading Assemblies on .NET Framework due to Fusion Publisher Policy?
If I create a new WinForms project targeting .NET Framework 4.7.2, and replace Program with the following code
static class Program
{
/// <summary>
/// The main entry point for the ...
1
vote
1
answer
107
views
Generate a XLS file using SQL CLR That does not have loads of incompatible Dependencies
I want to do something simple, Create a SQL CLR that converts data to XLS.
I've tried Using OpenXML, but it keeps installing windowbase as a dependency, which uses system.XAML, which SQL server (2019) ...
1
vote
2
answers
56
views
How is an assignment expression with return value optimized at assembly level in stack-based virtual machines?
In Java and C# and many common programming languages and runtimes using stack-based virtual machines, we write fundamental assignment expressions as simple as this:
a = 1;
and the compiler initially ...
2
votes
0
answers
72
views
Can I poison a class instance in C#
I am trying to add some Dispose cleanup in a large hierarchy where the default dispose method used to do nothing. When I do so, I get very rare and difficult to reproduce bugs that make me suspect ...
1
vote
0
answers
222
views
Why is import clr throwing an exception after pythonnet has been installed?
I am trying to access a .NET DLL from python using pythonnet. The dll contains a library that has been converted to .netStandard2. However, I am getting an error when simply trying to import clr. Can ...
0
votes
0
answers
358
views
porting C++ CLR .NET framework Winform to .NET 8
we have a tool that was written in C++ CLR where its forms where also written as a Winform in C++ CLR, we plan to upgrade it to .NET 8 but it seems there is a pretty huge shift between .net framework ...
-3
votes
1
answer
60
views
Is there a way to tie my C# methods to my Python scripts and check if they are valid? [closed]
A lot of my Python scripts interface with my C# code and when I make changes to my C# code, it breaks a ton of my Python scripts. I am running Visual Studio for all of my code and was wondering if ...
3
votes
1
answer
517
views
C# function pointers causes access violation upon calling from C++
In the following bit of code, I'm using C# function pointers to omit using a delegate type, for faster performance. The code works fine when I use a delegate type marshalled as a function pointer, no ...
-1
votes
2
answers
108
views
C++/CLI from typedef std::function to managed delegate
I have a big class from extern library and I need to use a unmanaged callback in managed code.
Unmanaged code simplified:
typedef std::function<void(const std::string &, Float)> ...
-3
votes
1
answer
48
views
Making a CLI CPP project from static library to DLL is causing LNK2020 linking errors [duplicate]
I have a CLI/CPP Project (say ProjA). It is referring for some functions defined in another CLI CPP static library (say ProjB).
I added ProjB as reference to ProjA.
ProjB also has some unmanaged cpp ...
0
votes
2
answers
165
views
Where and how are IL opcodes implemented in the .NET runtime source code
I was researching call vs callvirt opcodes with all of the gotchas along the way.
You can read the description online, but when you encounter this
The callvirt instruction calls a late-bound method ...
-2
votes
1
answer
582
views
Visual Studio 2022 CLR Empty Project (.NET Framework) entry point is not working, even after being set
I am trying to run a Windows Form in Microsoft Visual Studio 2022. When I attempt to run the solution I get the following error: "LNK1561 entry point must be defined", which links to this ...
1
vote
1
answer
54
views
Do we have to use `CompareExchange` rather than `Exchange` in a hybridLock lock that uses AutoResetEvent?
The example below is from CLR via C# book that mimic a hybrid lock:
internal sealed class AnotherHybridLock : IDisposable
{
// The Int32 is used by the primitive user-mode constructs (Interlocked ...
0
votes
1
answer
1k
views
The Common Language Runtime (CLR) was loaded in an unsupported manner
I am trying to create a a stored procedure in SSMS that makes use of CLR.
I don't think the script matters, because it works on other machines.
The error I'm receiving is:
Msg 10335, Level 16, State ...
0
votes
2
answers
304
views
How to call a delegate in C# (Windows forms) from an unmanaged C++ dll
I've seen a few examples of how to do this from C++ an unmanaged dll, to a C++ managed CLR dll. I currently have a C++ dll (NetPcapWrap), that references a C dll (npcap.dll). Since the npcap.dll is ...
1
vote
0
answers
44
views
Missing type from Microsoft.SqlServer.Server [duplicate]
I'm trying to follow the example here
and I get to the first block of code before I get an error, The type or namespace name 'SqlProcedureAttribute' does not exist in the namespace 'Microsoft....
2
votes
0
answers
382
views
Explicit Type Casting in Python.NET
I am working with a .NET Framework DLL from Python using Python.NET.
The DLL allows you to fetch the parent of a given object, but will return the parent as an instance of the interface ...
0
votes
0
answers
33
views
Issue with Closing Login Form and Opening Dialog Based on Authentication Result
I've been working on a login form which I'm creating with C++ and SQL server database.
The main login form reads everything correctly from the database but I get an error starting a new dialog box to ...
-2
votes
1
answer
86
views
C++/CLI Wrapper class track unmanaged object pointers
I have an unmanaged C++ class SRWindow that I want to wrap in C++/CLI. The wrapper class is called SEWindow and has a constructor that also creates an SRWindow object:
public ref class SEWindow
{
...
0
votes
1
answer
368
views
Why Interlocked.Read uses Interlocked.CompareExchange internally?
below is the source code with my comment for Interlocked:
public static class Interlocked {
// Int32 old = location;
// if (location == comparand) location = value;
// return old;
public ...
1
vote
1
answer
183
views
How does Interlocked.MemoryBarrierProcessWide() work internally?
based on this article: https://www.albahari.com/threading/part4.aspx
we know that volatile doesn’t prevent a write followed by a read from being swapped, and this can create brainteasers:
class ...
2
votes
1
answer
485
views
Creating a C# DLL to use in C++ executables
I have been struggling with this topic for 1 week now and nothing I tried seems to work.
I made a very simple C# class:
namespace SimpleMathLib
{
public class SimpleMath
{
public float ...