3,954 questions
0
votes
0
answers
81
views
how does compiler handle optimizations for IF statement
I was reading a book that describes why Volatile is needed
class ThreadsSharingData {
private Int32 m_flag = 0;
private Int32 m_value = 0;
// This method is executed by one thread
public ...
0
votes
0
answers
108
views
Is it valid practice to use GCHandle.Alloc(this)?
I am interfacing with a native library. The library provides Types of their internal workings, and some Types have a void* userData.
Because of the way the library is laid out (you can't access a ...
1
vote
1
answer
93
views
How to emit IL for ref locals using ILGenerator?
The following C# snippet:
int x = 10;
ref int y = ref x;
is compiled to this IL:
.locals init (
[0] int32 x,
[1] int32& y
)
ldc.i4.s 10
stloc.0
ldloca.s 0
stloc.1
ret
How do I create a ...
0
votes
0
answers
50
views
CLI dll compiled for release, depends on debug versions of vc Runtime dlls
I'm building a C# WPF app (.NET 7.0) that uses a CLI/CLR .dll. Both the app and dll are built in release mode, as is the static library the dll wraps. Despite all this, the dll still depends on debug ...
-1
votes
1
answer
60
views
Why .NET Garbage collector donot invokes destructor of an abandoned object?
I have a simple Account class. When I create an object referenced by "a". But after that I assign null to a. Further I have invoked GC.Collect(), whose job is to clear all abandoned object ...
1
vote
1
answer
243
views
CLR Table Valued Function Parameter Count for FillRow method error
I have a C# (.NET Framework 4.7.2) script to perform some custom reading of trace codes, which I am trying to use to make a SQL (V14.0.3445.2) Table Valued Function. The C# FillRow Method looks like ...
1
vote
0
answers
74
views
MySQL Connector C++ Visual Studio CLR throw exception
I want to create Windows app, which uses DB through MySQL. I try work with DB in Console App, it works fine:
#include <iostream>
#include <string>
#include <mysql_connection.h>
#...
2
votes
1
answer
165
views
Hosting CLR: Calling .NET constructors/methods reflectively from C++, when some parameters are Enums
I have a native program that hosts the CLR (i.e. starts it up manually, gets a reference to an AppDomain, etc. - this is not C++/CLI). Within that context, I want to instantiate a FileStream object.
...
0
votes
1
answer
318
views
When the JIT Compiler for .Net 6.0 loads a .dll mid-execution, does it load the entire .dll in-memory, or only the methods needed?
Our programs are running in an environment where it is bad to be wasteful of RAM. There are a large number of large 3rd-party packages we could use in our code that would make writing the code ...
4
votes
2
answers
1k
views
How does the Span<T> type wrap around heap-allocated arrays if it's a stack-allocated value type in .NET Core CLR?
How can Span wrap around a heap allocated Array if it is supposed to be a stack allocated value type?
Reading through the MSFT documentation on the Span type, I came across the following:
When it ...
0
votes
1
answer
823
views
pythonnet clr: how to get the signature of a function/method?
When importing a .NET library in Python with:
import clr
clr.AddReference(r"C:\foo.dll")
from foo import *
my_foo = Foo()
print(my_foo.my_method)
# <bound method 'my_method'>
I'd ...
0
votes
0
answers
43
views
Why is .NET selecting base class from incorrect version of the assembly?
I have a unit test that depends on a type Derived that inherits from a base class Base. Derived and Base are in separate third-party assemblies Derived.dll and Base.dll(2). Both DLLs are strong-named. ...
1
vote
2
answers
2k
views
What is the point of defining "shadow properties" in Entities?
This question may seem silly,
but what is the point of defining "shadow properties" in Entities since the corresponding column would be created in Database/Tables?
Plus, we can simply solve ...
1
vote
1
answer
154
views
CLR Reflection and Metadata management - where is the truth?
I always thought that Reflection in CLR loads metadata for types on demand, when you actually request needed information. And then it is cached, and all subsequent calls will be cheaper. At least, ...
-1
votes
1
answer
915
views
Threading in C++/CLI, CLR
Faced a problem. Need to call a class member method on a separate thread C++/CLI
.h:
ref class BgWorker
{
private:
void MainLoop();
public:
void Start();
};
.cpp:
void BgWorker::MainLoop()
{
...
1
vote
1
answer
1k
views
Unable to install pythonnet clr module by uninstalling clr and re-installing clr
I am trying to import clr and receive the following error:
AttributeError: module 'clr' has no attribute 'AddReference'
I have tried to follow the steps here, where I uninstalled both pythonnet and ...
0
votes
1
answer
36
views
Unable to override .NET abstract class in CLR/C++
I have
logger.cs:
public abstract class LogProvider
{
protected abstract void DoLog(LogEvent logEvent);
}
my_code.cpp
ref class DebugLogProvider : public LogProvider
{
public:
virtual void ...
0
votes
0
answers
61
views
Troubleshoot custom CLR audit trigger without source code?
I have a custom .NET CLR trigger that is hooked up to my database to handle slightly more advance insert, update, delete triggers. Basically it is tying in some data not readily available to the ...
1
vote
0
answers
409
views
An error occurs in clr import.[python.net]
When I import clr I get an error.
Environment
pythonnet version: 3.0.1
Python version: Python 3.9.7
Import clr.
import clr
I get an error.
I would like to know how it works properly.
C:\Users\user\...
0
votes
1
answer
102
views
clr table valued functions
I created this clr table valued functions in VB.NET using VS 2017 and sql 2014:
Imports System.Collections
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports ...
0
votes
0
answers
143
views
Alter Assembly not altering an assembly
Recently we have noticed that ALTER ASSEMBLY is not updating the dll on the SQL Server. We have been altering the assembly since last two years and never had an issue before. The major change we have ...
0
votes
1
answer
183
views
passing parameter (with ref) and string array into a .net function with clr pythonnet
I have this function in a dll that i imported via clr in python with asNetArray function that i found somewhere in the net.
public static double DrawdownTable(ref System.Array resDrawdown, ref System....
2
votes
1
answer
87
views
Different releases of Microsoft.Build.* assemblies have the same 15.1 version leading to issues
It seems like at some point assemblies Microsoft.Build, Microsoft.Build.Framework, etc. stopped changing their versions after updates, so the versions of actually different Microsoft.Build assemblies ...
1
vote
0
answers
717
views
D8016 '/clr' and '/MT' command-line options are incompatible
I have made an Windows Application using visual c++[CLR Empty Project].But when I run that .exe file in another PC i get error of ucrtbased.dll, VCRUNTIME140D and MSVCP140D file is missing.
For this, ...
-3
votes
1
answer
398
views
Wrapping c++ class so I can use it in c#
I have this c++ header:
// BRepPrimAPI_MakeSphere.hxx file
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <BRepPrim_Sphere.hxx>
#include <...