Skip to main content
Filter by
Sorted by
Tagged with
2 votes
0 answers
32 views

Does a default interface implementation on a struct introduce boxing? [duplicate]

I am making a simple network messaging system, and I have designed it around using structs for any small messages (and I am trying to avoid boxing as much as possible). The system is already working, ...
Aman Anas's user avatar
-1 votes
1 answer
46 views

The Debugger was configured to use the Desktop CLR (.NET Framework), but the target process loaded the CoreCLR (.NET Core) runtime

I have a project which is C# Class library (.NET Framework) a .dll, and im loading inside it the Revit API libraries in the references, when i run it without debugging (Ctrl + F5) everything goes well,...
In The League's user avatar
0 votes
0 answers
53 views

C4642 Warning in C++ CLR Library (DLL) with Winform (.Netcore8)

I am getting this warning in my C++ CLR DLL with Winform in .NetCore 8 warning C4642: 'IHandle': could not import the constraints for generic parameter 'THandle' warning C4642: 'HandleRef': could not ...
user2300947's user avatar
1 vote
1 answer
875 views

No CLR runtime found error after calling dumpheap -stat

ERROR: No CLR runtime found. This means that a .NET runtime module or the DAC for the runtime can not be found or downloaded. Hello when I try to analyze memory dump of a running process: I run ...
Atahan Ceylan's user avatar
0 votes
0 answers
345 views

Unable to debug with following error: "Unable to attach to CoreCLR. A debug component is not installed."

If I create a new project with "Blank App, Packaged (WinUI 3 in Desktop)", replace <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> of App1.csproj with <...
appletree5641's user avatar
2 votes
1 answer
2k views

How to setup envs in neovim DAP configs for dotnet c#?

I am trying to debug my c# app with neovim DAP. Here is my configs: local dap = require('dap') dap.adapters.coreclr = { type = 'executable', command = '/home/asd/netcoredbg/netcoredbg', args = {...
Vlad Mosienko's user avatar
1 vote
0 answers
1k views

.Net application aborts at startup with "Failed to create CoreCLR, HRESULT: 0x80004005" on windows server - when upgrade .Net5 to .Net 6

I' v decided to upgrade a project from .net5 to .net6. After upgrade when I publish and then deploy through CI/CD server (a GitLab runner) that contains .net6 runtime, the production server that ...
Narges Mousavi's user avatar
0 votes
2 answers
389 views

Linux Server Can't Run ASP.NET using dotnet Command

I installed .NET 7.0.3 on my Linux Server. I also deployed a few MVC websites in .NET 7.0.0 behind an Apache reverse proxy. But when I run dotnet <DLL NAME>.dll, It is saying it can't find a ...
Alen Smith's user avatar
  • 1,512
0 votes
0 answers
954 views

Cannot publish .NET 4.7.2 project from console error MSB4062

Trying to publish a console C# .NET Framework 4.7.2 project using this command dotnet publish W-INST.csproj --configuration Release --runtime win-x64 --no-self-contained --framework net472 /p:...
MrCalvin's user avatar
  • 1,792
0 votes
1 answer
287 views

How to set up AppContext.BaseDirectory when hosting CoreCLR with hostfxr

I'm following this sample/tutorial to host CoreCLR in my native app using hostfxr, I've successfully set up the runtime and got the function pointer to call into managed code. However, in the managed ...
Sardelka's user avatar
  • 474
0 votes
1 answer
557 views

Find which target framework application is building on?

I have old .NET Core project. Under application properties the project's Target framework is .NET Core 2.0 But on the build server We don't have 2.0 SDK installed. Instead we have other SDK versions, ...
LP13's user avatar
  • 33.5k
3 votes
2 answers
9k views

Failed to create CoreCLR, HRESULT: 0x80004005 while running a .NET 6 Console App in Windows server

While I’m deploying .Net 6 console application into the Pseudo Server, I’m getting this error. The same runtime has been installed in the test server and it works fine. Enabled trace to see more info ...
Subash's user avatar
  • 33
0 votes
1 answer
294 views

How to recognize extension method from assembly?

As far as I know, the C# extension method has the attribute of 'System.Runtime.CompilerServices.ExtensionAttribute' so i wrote simple test and I check with ilspy and this does not exist there. I also ...
Yanshof's user avatar
  • 9,886
0 votes
1 answer
567 views

How are multi-dimensional arrays stored (.Net)?

I have a few questions about how .Net stores multi-dimensional arrays in memory. I am interested in true multi-dimensional arrays not jagged arrays. How does the Common Language Runtime (CLR) store ...
andypea's user avatar
  • 1,381
0 votes
1 answer
582 views

How to I solve a Visual Studio Fatal Error during debugging involving Desktop CLR, CoreCLR and recommending Managed Debugger

I'm afraid the error is so baffling to me I didn't even know how to word the question! I'm writing a plugin that's a class library for a Third Party Application (call it 'ApplicationX'). I had this ...
stigzler's user avatar
  • 977
0 votes
0 answers
711 views

Activator.CreateInstance(type, args) replaces null with default value for non-nullable constructor parameter

Why does this code compile and run when param2 is non-nullable? I can't find anything in the docs saying that a default value is used when null is passed to a non-nullable constructor parameter via ...
3-14159265358979323846264's user avatar
2 votes
0 answers
206 views

Loading DLLs built for different runtime versions in .NET Core AssemblyLoadContext

We use .NET 6's AssemblyLoadContext to setup a plugin system. Is it, for example, possible to load a .NET Core 3 or a .NET 5 dll in an AssemblyLoadContext in a process that was built for .NET 6? And ...
brz's user avatar
  • 1,949
0 votes
0 answers
497 views

Is it possible to expose my own methods to C# in a custom native CoreCLR host environment?

I've been following this guide to create my own .NET Core 6 host from an unmanaged C++ application using hostfxr.h and nethost.h, and interface with a managed DLL written in C#. I can retrieve and ...
Lázár Zsolt's user avatar
0 votes
0 answers
112 views

Exception handling inconsistency when using Hostfxr to call a callback method in a try catch on ubuntu

Im playing around with the hostfxr sample and got it working a bit but im running into an issue when using exceptions n c++ The setup I have now is that the NativeHost.cpp has a method that throws an ...
Gert Kommer's user avatar
  • 1,203
0 votes
0 answers
947 views

CMake & CoreCLR, Visual Studio debugger issue

Situation I'm currently working on a small project where I would like to be run .NET 6.0 managed code from my C++ host. I started following these MSDN docs, which lead me to this sample project. This ...
Joris Eijmberts's user avatar
4 votes
1 answer
3k views

How to check current log level using ILogger?

I am using Microsoft.Extensions.Logging.ILogger. I want to log request object only when LogLevel is set to Information I know I can log the request object as _logger.LogInformation("{request}&...
LP13's user avatar
  • 33.5k
1 vote
0 answers
188 views

How can c++ host pass byte[] array "output parameter" to a c# method on both windows and linux?

I know which tag I should use when the c++ host passes an input parameter to a c# method on both windows and Linux, but in my project, the c# api has a "byte [] array" output parameter like ...
Jun Ge's user avatar
  • 428
1 vote
1 answer
384 views

.NET Core Application CPU Hang

I'm trying to debug a sporadically/randomly occurring application hang. It seems to happen at random times (especially when debugging the application). This seems to have started around our upgrade to ...
Jeff's user avatar
  • 36.4k
0 votes
0 answers
238 views

CoreCLR internals: how CLR resolves length of array

I've been trying to find out the implementation for Length property of System.Array class (just out of curiosity). So, in the official dotnet/coreclr repository I've found the definition of that class ...
thedenisnikulin's user avatar
0 votes
0 answers
90 views

Why .NET Core loads dependencies that have superior version?

I have a project that depends on Newtonsoft.Json v12.0.1, when i delete this version from the bin folder and i put superior versions (e.g. v13.0.1) the app keeps executing normally. My questions are : ...
youssef jirari's user avatar
2 votes
0 answers
330 views

How the CoreCLR resolves project dependencies?

Lately, I was working on a tool that verifies if a given binary could load the needed dependencies at runtime, for .NET Framework binaries the resolution of dependencies is pretty straightforward as ...
youssef jirari's user avatar
2 votes
1 answer
271 views

Compiler for CLR

I am working towards building a small language or dst that makes use of .net/clr. Aside from reading a lot the most progress I made is a C# program that takes some basic input (no ebnf actual lexing ...
GreatGaja's user avatar
  • 375
4 votes
1 answer
564 views

Asp.Net Core Dependency Injection doesn't work, if it is started from unmanaged/native

First i try to explain the story. I wanted to extend an C++/MFC application with REST-APIs, and decided to use for this purpose Asp.Net-Core 5 in a library by bridging it to unmanaged code with C++/...
Yusuf R. Karagöz's user avatar
0 votes
0 answers
38 views

Frozen C#/.NET when debugging a program with multiple dynamically-generated assemblies

We have a program that utilizes System.Emit's ability to generate types on the fly. As time goes by, the number of types we are generating reaches over tens of thousands. This revealed a performance ...
user13733218's user avatar
15 votes
1 answer
6k views

Is .NET Core or .NET 5.0 supported by Pythonnet

I've been using Pythonnet for quite some time but always against .NET Framework 4.* With the recent release of .NET 5.0 I wanted to migrate my projects but I could not make it work for non-Framework ...
jo31's user avatar
  • 187
0 votes
1 answer
251 views

How to compile CoreCLR (compilation problems)?

I have a problem compiling CoreCLR on Linux (Linux Mint 64-bit). There is one error and two messages (Sorry for the translation from my language): -- Configuring incomplete, errors occurred! See ...
Maniues's user avatar
  • 125
8 votes
1 answer
945 views

Why is my break point not triggered using !bpmd in Windbg with SOS and .Net Core 3.1?

I recently learned about the process for debugging managed code in Windbg with sos. I've looked through numerous examples and from what I've seen, this should work. But it doesn't. This is a .net core ...
Baruch's user avatar
  • 87
5 votes
2 answers
4k views

Wpf app crashing - Faulting module name coreclr.dll version: 4.700.20.47201

I have WPF application on .netcore 3.1 packed in appx package and installed from the package. Sometimes (one on several dozen starts) it crashes on startup with errors in EventViewer: first error ...
Asteron's user avatar
  • 103
3 votes
4 answers
1k views

ZipArchive does not flush zip item immediately

I am creating a zip file using ZipArchive + FileStream. When new item is added into zip file, I would like to flush/write newly added item to underneath zip stream. The code below is not flushing the ...
LP13's user avatar
  • 33.5k
4 votes
1 answer
559 views

C# How volatile and interlocked affect cpu cache

I'm trying to understand how volatile reads/writes and interlocked operations in c# affect the processor cache. I have read in some places that both of those operations flush the processor cache. I ...
Thanuja Dilhan's user avatar
1 vote
0 answers
2k views

How to handle large file stream in AWS Lambda?

I have the following code to download files from S3 and then zip it. For brevity i have excluded some of the code. public Download(IList<string> urls) { var maxConcurrentDownloads = 20; ...
LP13's user avatar
  • 33.5k
6 votes
2 answers
2k views

How to install CrossGen to optimize .NET Core Library in ci/cd

I am attempting to pre-jit/Ahead-Of-Time (AOT) compile a .NET Core 5 Library to a Native Image using Microsoft's CrossGen utility as described here to improve start up time. However the instructions ...
Philip Pittle's user avatar
1 vote
1 answer
781 views

How to Suppress JIT optimization in .NET Core

I can't find a way to suppress JIT optimization in a .NET Core 2.2 process. This prevents me from attaching with a debugger in production and seeing all local variables. In .NET Framework I could add ...
Michael_S_'s user avatar
1 vote
2 answers
203 views

Use types from .NET 5.0 while remaining compatible with earlier .NET versions like .NET Core 3.1

Suppose you would want to utilize the new System.Half, but you also want your library to be used by .NET Core 3.1 apps (or older). I could simply copy the System.Half implementation and lose the ...
Abel's user avatar
  • 56.9k
1 vote
1 answer
742 views

passing C# managed instances between C# and C++ when native process is hosting the .NET Core runtime

I am prototyping using the HostWitHostFxr sample which allows a native process to host .NET Core using the nethost and hostfxr libraries. https://github.com/dotnet/samples/tree/master/core/hosting/...
Robert Dugal's user avatar
1 vote
0 answers
1k views

Getting SQL1159 Initialization error with DB2 .NET Data Provider, reason 2 in .NET runtime but it works in Classic ASP.NET Framework runtime. Why?

I get the below exception when trying to access a .NET Framework class library which has the data access code from a .NET Core API project. Exception: SQL1159 Initialization error with DB2 .NET Data ...
Jerin Nishok's user avatar
0 votes
0 answers
212 views

.NET: Why has the unsafe option be made irrelevant?

I just realized that there now is System.Runtime.CompilerServices.Unsafe. You can create a console application, write Unsafe.AddByteOffset(ref (new int[1])[0], (IntPtr)Int32.MaxValue) = 42; and you ...
John's user avatar
  • 6,947
-1 votes
1 answer
162 views

vscode debug c# application

I created a simple "hello world" .net application using the following command: dotnet new console -n testApplication When i launch the application using the command: dotnet run everything is fine;...
Stefano D'Urso's user avatar
1 vote
1 answer
205 views

Build .NET Core 3.1.1 from git repository

I would like to build from source the .NET Core 3.1 CLR and libraries. I checked out the latest from https://github.com/dotnet/runtime. Running the build scripts will produce the next version of .net ...
Ron Kuhn's user avatar
2 votes
1 answer
537 views

Instrumentation Profiler in CoreCLR - Ways to Load HelperAssembly in to dotnet process

I am trying to Instrument .NET Core web applications that runs on .NET Core 3.1 using CoreCLR Profiler in linux centos7. I have set the environment values CORECLR_PROFILER , CORECLR_ENABLE_PROFILING ...
jay's user avatar
  • 61
2 votes
1 answer
1k views

Hosting .net core and creating managed instances

I'm attempting to load a .net core library in a native application with the intention of creating an instance of a managed object I've followed Microsoft's recommendation to use hostfxr to load the ....
Clint Good's user avatar
0 votes
1 answer
2k views

How to use LazyCache with async function that takes parameter

I am trying to use LazyCache. The api has GetOrAddAsync that takes Func<Task<T>>. This is the function that build stuff i want to cache. However the function that i have takes input ...
LP13's user avatar
  • 33.5k
1 vote
1 answer
456 views

How to print WCHAR [ ] into a file in linux

I am trying to profile .NET core application using IcorProfiler API(compiled using clang++) in linux. Here I am trying to Print module name in to the file, that filled using GetModuleInfo2() in WCHAR ...
jay's user avatar
  • 61
1 vote
1 answer
100 views

Netcore2.2 app aborts in release configuration on a Linux machine

Also logged: https://github.com/dotnet/coreclr/issues/27734 Code attached: https://github.com/dotnet/coreclr/files/3820061/Program.zip We have an issue with the attached (heavily cut down) project ...
Ross Gurbutt's user avatar
  • 1,019
3 votes
2 answers
3k views

How to generate a reasonably sized memory dump file of a .NET Core process on linux?

I'm trying to generate a reasonably sized core dump of a running .net core process using gcore, but the file is larger than 20GB. The process is dotnet wapi.dll which is the binary of an empty project ...
Ashkan Nourzadeh's user avatar

1
2 3 4 5
7