Click here to Skip to main content
15,889,315 members
Everything / CLR

CLR

CLR

Great Reads

by matt warren
Fortunately, there’s a fantastic tool that makes it very easy for us to get an overview of memory usage within the CLR itself. It’s called VMMap and it’s part of the excellent Sysinternals Suite.
by Graeme_Grant
This is an alternative for "Simplest WPF Dependency Property For Beginners On Background Color"
by Martin Lachman
How to create a system on MS SQL Server for detection of actual changed records in a database table.
by matt warren
A while ago I wrote about the 'special relationship' that exists between Strings and the CLR, well it turns out that Arrays and the CLR have an even deeper one

Latest Articles

by Bruno van Dooren
Ways to deal with changed security for CLR code in SQL databases
by wmjordan
Do something crazy and dangerous with CLR and a method made from Dynamic Assembly
by DiponRoy
Creating CLR in SQL Server
by Mohammed Abdulla (ABSS)
Step by step procedure to xcopy deploy .NET assembly into fox-pro application

All Articles

Sort by Title

CLR 

24 Jan 2016 by Dmitry Orzhevsky
This article dives into .NET method inlining topic and shed some light on one particular case when CLR is more likely to inline method - looping.
16 Nov 2014 by Ronnie Mukherjee
This is a beginner's guide to garbage collection in .NET
2 Aug 2017 by matt warren
It’s a fundamental part of .NET and can often happen without you knowing, but how does it actually work? What is the .NET Runtime doing to make boxing possible?
4 Jul 2014 by MikeS_BelAirMd
Hi Everyone,So, I'm trying to create a win32 application with a nice UI, and after some research decided that WPF is probably the way to go (as I used to work with MFC based UIs in the past when doing win32 apps). I'm a C/C++ developer, so I prefer developing in Visual Studio 2012, as the...
4 Jul 2014 by Sergey Alexandrovich Kryukov
The more I looked at your situation, the more I see something which looks pointless to me. No, I'm not talking about using your C/C++ code; you explained something I expected to hear from you. So, what is that? Ah, of course. Using C#. Why would you even do that, if you essential code is...
12 May 2019 by Richard MacCutchan
This is the same question as How to check dllmain function is returning false[^]. Please do not repost.
9 Mar 2023 by Richard MacCutchan
Console applications do not have a UI, they are simple terminal style applications with text in and out. If you want to use UI compomnents then you need to create a UI application: WindowsForm, WPF, UWP etc. Both Microsoft and CodeProject have...
9 Mar 2023 by k5054
As Richard notes, there's no GUI for the console. However there are a number of TUI libraries out there that may help with things like dialogs, pull-down menus, etc, like this one: GitHub - magiblot/tvision: A modern port of Turbo Vision 2.0,...
9 Mar 2023 by Member 14594285
I created a empty project clr that calls a c# library..it works but it's a console application: #using "consume_cs_indexers.dll" //#include "DlgClass.h" using namespace System; int main() { IndexerClass ^ ic = gcnew IndexerClass; int...
16 May 2017 by matt warren
A while ago I wrote about the 'special relationship' that exists between Strings and the CLR, well it turns out that Arrays and the CLR have an even deeper one
11 Jan 2012 by SergioAmorim
A way to quickly find the CLR version of a .NET assembly from the command line
11 May 2018 by RedDk
I haven't asked a question for a long time but these two are so prescient that I'd be very surprised if the matter hadn't come up at some time in the experiences of many if not most CPians here at some point in their experiences using Visual Studio. First, has anyone ever BROWSED (not made an...
11 May 2018 by Dave Kreskowiak
You cannot use assemblies in your app that target a Framework version higher than the one your app is targeting. While you may find cases were this will work, there are plenty of cases where it won't, and it seems you just found one. This is specially so if your app is targeting .NET 2.0, 3.0,...
17 Oct 2013 by Jhun_A
A vcxproj has been compiled using VS2010 and .Net 3.5 but when I check properties of the DLL (the compiled vcxproj), the runtime version is v4.0.30319. How come that the dll was built with this version of CLR?
17 Oct 2013 by Sergey Alexandrovich Kryukov
No wonder, VS 2010 supports this version of .NET, v.4.*. The only problem is your understanding the it "has been compiled using VS2010 and .NET 3.5". Not that is could be true or false, this combination of words simply makes no sense. It's apparent that it was a MSBuild-standard project, of the...
20 May 2012 by cpsglauco
How to use delegate in List.Find() predicate in C#
7 Nov 2011 by amir.dar
hi guys.i have a CLR project and a c++ managed class.i need to mimic the behavior of the "is" keyword from c# but i dont know how to do it in managed code.part of my code:1.C# code:public class emailMsg : Msg{ string email;}2.C++ manged codeMsg^ msg = gcnew...
7 Nov 2011 by OriginalGriff
dynamic_cast
12 Dec 2013 by Luiey Ichigo
Hi coders,I'm facing a problem here. I'm not C++ person. I do VB.Net. I got a .h and .cpp file. Some of the code is successfully translate but there is 1 thing from the code that I can't understand. Can someone who experience the C and VB.NEt to see this. Below are my code:From...
12 Dec 2013 by OriginalGriff
Try: rsp(i + 11) -= ChrW(&H30)Or better, declare a constant and use that:Private Const myOffsetValue As Char = CChar(&H30)...rsp(i + 11) -= myOffsetValue
28 Jun 2022 by code_pop
Hi all. I'm using the C++/CLI dll on the C# WinForm project. To pass from the native code's exception message to C#, I have written the code as below. #include "pch.h" #include "ClassLibrary1.h" using namespace ClassLibrary1; void...
4 Apr 2019 by Member 14150165
I'm new to managed C++, dealing now with a C++/CLI project which involved function calling from native DLL for results to be displayed via WinForm. An expected exception is encountered when calling function from native DLL due to missing equipment for the project. However, instead of...
16 Feb 2015 by RAHUL(10217975)
Hello ,I am working on Asp.net website and SQL DB, For Security reasons we are keeping different database for each customer. Now problem is DB objects like Stored Procedures, Views is replicated for each database. If I want to alter any SP ,views or table then I have to do it in all DB's....
16 Feb 2015 by Lolo1986
From my understanding you are in SAAS environment. Where I am working right now with have 70+ databases with the same schema, sp, tables... So what you should do is having one common project (cleintProject) and deploy your project against the different clients. So you will maintain only one...
25 Feb 2015 by deepakdynamite
I had same kind of scenario.. But After doing this manually for 3-4 times, I developed an small win form application which will fetch list of databases from one centralized database and will execute scripts on each table... **Note: I created that application for my purpose.. I never gave it to...
25 Feb 2015 by Joan Magnet
I use ApexSql Diff to do this job.It' really useful, maintain one and replicate to all.ApexSql Diff
15 Apr 2016 by Member 10185036
I need to use my C++ dll in C# application. I created a wrapper project in CLR and linked with C# app.I am getting random crashes while accessing the memory created in c# application in my CLR wrapper methods and sometimes in my C++ dll project. I am sure my dll project is a foolproof...
15 Apr 2016 by KarstenK
you must allocate real memory for your arrayint[] MyArray = new int[3];I dont think you need it, but it makes your intention clearerfixed (int* pointer = MyArray){ A_Wrap Wrapper = new A_Wrap(); Wrapper.CLRDllMethod(pointer); //all stuff with the array}
11 Mar 2013 by Basheer Belgod
. I have one query ie is in GAC i put two assembly with same name but different version, in this case CLR will select the new version assembly, what is the concept behind this..
11 Mar 2013 by Sergey Alexandrovich Kryukov
The question is not clear, but, no matter what it is, you will need to learn the following...
23 Mar 2016 by vilish.shah
I am am learning CLR And would like to delete file from SQL SP File located are on different server.Any help would be much appropriated.Thanks in Advance.What I have tried:i have tried following code and complied.Imports System.IO Public Class CLRFunctions ...
23 Mar 2016 by Sergey Alexandrovich Kryukov
Most likely, you simply should not delete the file the user don't have permission to delete. This would be the best solution in most cases. Know legitimate directories and files, and those which you should not touch.But now, let's consider the cases when you really need to delete the file...
23 Jun 2011 by Jeff Pufnock
Was hoping you could shed some insight into my problem. My CLR function that I deployed to my Sql Server 2005 database executes cleanly when it does nothing except return a value of zero. When I have it try to execute a Windows Batch file that has a single line in it (dir >...
17 May 2011 by Sergey Alexandrovich Kryukov
There is no such thing as "DOS Batch file" anymore! How much longer shall we see such questions about something which does not exist.Batch files are batch files; there is nothing of DOS in them. By the way, the syntax became more advanced compared to DOS time; writing batch became considerably...
5 Jan 2012 by meace1234
VS2010 CLR double to String, String to double methodsto get data in and out of editText Textboxes in MSVC / VCpp? Are there any good examples for gui on C++ in VS2010 ?
5 Jan 2012 by Richard MacCutchan
I already answered this question here[^]: please do not post in multiple forums.
29 Nov 2014 by rezaasaadi
I have a hardware that I can control using its device driver.Driver is a simple dll and I read and write to this device using a VC# program successfully(VS2010).Now,the architecture of program forces me to read/write to this device every time a user updates some tables in a database or calls...
3 Jun 2012 by vivekx2
Hi everyone ,, I have clr profiler when i click "start applicaton" I open my site in new tab and click "kill application" button...."""Unhandled exception error appears in your application""" error displays...How to recover this error..Can anyone help me....
10 Mar 2015 by Jignesh G Trivedi
This tip will help you to understand CLR procedure.
5 Aug 2014 by Santiago Fabian
I want to know if its possible to create a CRL stored procedure in C# with a parameter of enum type?If so, what value should I pass to this parameter once I execute it in sql server management studio?My c# code would be something like this to give you an idea:enum Processtype { ...
5 Aug 2014 by Sergey Alexandrovich Kryukov
Unfortunately, "stored procedure" is never CLR. By definition, this is a SQL procedure. The code being executed in CLR can only create the code of the SP, trigger its execution, pick up the results of its execution from the SQL server.And SQL does not have general enumeration types. (Some...
29 Aug 2012 by Girish J Jain
Lets learn different CLR versions which exist and did we miss one between v2.0 and v4.0?
29 Aug 2012 by Girish J Jain
Let's learn the compatibility between multiple CLR versions which exist and how we can use the supportedRuntime element in an application's configuration file.
17 Jul 2012 by dbugbee
I'm trying to mimic the SQL xp_getfiledetails procedure, but I haven't been able to figure out how to do impersonation. How can it be implemented in the following code (which works fine when the SQL Server has access to the share.) The assembly already has External Access...
17 Jul 2012 by abhinavvijay
hi,you can use impersination in you codefollow the below link A Complete Impersonation Demo in C#.NET[^][^]
21 Jul 2014 by Mohammed Abdul Mateen
Hi,We're creating a WPF app in which we execute python scripts from different Test Stations and show the output in its corresponding output panel, To run the scripts in parallel we are using Task but when we run the scripts in parallel from the stations, We are getting the output of other...
21 Jul 2014 by Nagy Vilmos
There is a lot missing from your code, but I will hazard a guess that you need to check the socket you send the reply out to. I am guessing that whatever socket you read the inbound message from, the reply is always sent to the first one created.As each connection is made, hold the socket...
17 Sep 2014 by Mohammed Abdul Mateen
Quote:We were able to solve the issue by getting clues doing a sample app to reproduce the issue and to first know whether our ClrZmq pattern was correct for us or not and it is correct. The resolution we followed is that when we needed to bind that data to its corresponding View's Model object...
8 May 2013 by Jon Woo
This article is intended to help conceptualize the area of JavaScript Object Oriented Programming by comparing it to the way .NET CLR works.
4 Nov 2012 by azinyama
Good day all!!!I have just started learning about CLR Stored Procedures and I wanted to know how to convert my existing stored procedures to CLR Stored Procedures. Could you show me, with code, what this stored procedure should look like. I'm using VS 2010, VB.Net, MSSQL Server...
5 Nov 2012 by Richard MacCutchan
Take a look at CLR Stored Procedure and Creating It Step by Step[^], here on CodeProject.
27 Nov 2014 by Member 11071746
Hi, I am trying to execute the SQL CLR as below Create assembly [SQLCLR]from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SQLCLR.dll'with permission_set=EXTERNAL_Access;the dll is referenced to another dll (ESEWS.dll) which is consuming web service of our application....
15 Nov 2020 by John Robert Connolly
I have created a CLR that is in vb and is very basic: It send out smtp emails and has one import: Imports System.Net.Mail I created the assemble successfully and I can run the CLR Code but when I do I get the following error message below: ...
16 Nov 2020 by Richard Deeming
You'll need to create the CLR assembly with UNSAFE permissions to send email. Creating an Assembly - SQL Server | Microsoft Docs[^]
14 Jun 2012 by Serbeer
Do you know where/how in Visual Studio VC++ CLR project a specific Data Connection is referred to/stored? I created VC++ CLR project using SQL Server Project template in Wizard and it made me enter database information while creating it. My project is now completed and I was able to use Deploy...
14 Jun 2012 by Espen Harlinn
I just created a new clr project, and dropped an SqlConnection component on the form. Edited the connection string and void InitializeComponent(void) looks like this:void InitializeComponent(void){ this->sqlConnection1 = (gcnew System::Data::SqlClient::SqlConnection());...
4 Oct 2016 by Martin Lachman
How to create a system on MS SQL Server for detection of actual changed records in a database table.
19 Dec 2011 by David Catriel
Creating a .NET trigger for SQL Server that will log (down to the field level) all changes made to tables.
18 May 2016 by Manzoor Ahmed P
We use the same key i.e 'using' for including the name space and also to call the Dispose method on the object like...using System.Object;andusing (SqlConnection conn = new SqlConnection(connString)){ ...}My question is how the compiler will know for what purpose the keyword...
18 May 2016 by Zafar Sultan
1. As a directive(shortcut for namespaces):System.Data.SqlClient.SqlConnection myCon = new System.Data.SqlClient.SqlConnection(connectionString);To simplify the above statement just write:using System.Data.SqlClient; before any declaration(on very top of the class) and then you may write...
18 May 2016 by F-ES Sitecore
It does it by context. If the keyword is outside of a class\method it assumes you are doing the namespace version, if the keyword is inside a class it assumes it is the object dispose version.
27 Nov 2020 by Member 15003852
I am an intermediate in VC++ and trying to accomplish the following:- 1. Dock a timer created using Windows forms to the extreme right of the taskbar (and to the left of the notification area or system tray). 2. Make it responsive (match its...
4 Nov 2012 by Jerry.Wang
In this article, .NET CLR Injection: Modify IL Code during Run-time[^]. It uses symchk.exe to download the corresponding PDB file of the current loaded native DLLs (clr.dll / clrjit.dll / mscorjit.dll / mscorwks.dll).I want to get all the PDB symbol files for all releases(include preview)...
16 Dec 2013 by Member 10470908
Hi Jerry.Wang: Your are doing a good job, and your .NET CLR Injection solves my problem, thanks guy!
28 Oct 2014 by wubygtr
I have an MFC application on which I would like to integrate some .Net features; it is a server application that has to be as much performant as possibile, and I would like to be able to use some custom controls and other utility libraries written in C#.The question is: enabling the /clr...
28 Oct 2014 by CPallini
Quote:It is a server application that has to be as much performant as possibileIt all depends on the exact meaning of such a sentence.If you really need 'maximum performance' then every fancy library would have an impact.On the other hand, managed code is, in most cases, 'efficient...
19 Feb 2018 by Vishal Bhatia0112
Hello All, It's an C++/CLR project. I have below structure in my header file: value struct CONFIG { System::String^ Exch_Feeds; System::String^ Exch_Type; System::String^ Feeds_Type; int Feeds_port; int Max_Users; int IML_port; System::String^ Interface_IP; System::String^...
19 Feb 2018 by phil.o
Your problem does not seem to be in the structure declaration, but rather where you try to use it. The code you showed does not hold any cfg identifier. Find this identifier in your code, you most likely forgot to terminate one of your statements with a semicolon.
19 Nov 2013 by Aarviee
Found a lot on this error already, but my case does not get matched with any yet.I am building a solution (having many projects) in debug mode, and one of them is throwing this error, I am using VS2010 and language is C++, .net version 4.0, earlier this project was compiled in vs2008 and...
19 Nov 2013 by LaxmikantYadav
http://social.msdn.microsoft.com/Forums/en-US/34844476-8e2f-4947-b715-eb69edaf60d9/fatal-error-c1190-managed-targeted-code-requires-a-clr-option?forum=vclanguage[^]http://forums.codeguru.com/showthread.php?418133-How-to-run-a-very-long-SQL-statement[^]
19 Nov 2013 by Freak30
Regarding the second problem with the precompiled header, it looks like your Stdafx.cpp is compiled without the /clr option. You either need to switch it on there as well (possibly leading to problems with other classes); or set the Precompiled Header option (in C/C++ - Precompiled Headers) to...
11 Nov 2014 by jing567
Hello, I am trying to call a .dll code from my Sql Stored procedure . When I google I came across one link and tried in that manner.Link http://blog.sqlauthority.com/2008/10/19/sql-server-introduction-to-clr-simple-example-of-clr-stored-procedure/[^]But I tried CLR concept and...
28 Aug 2012 by kash_sheetansh
28 Aug 2012 by lewax00
The first set of errors (maybe all of them) should be solved fairly easily: . is not used for namespaces in C++/CLI, :: is, so...
30 May 2014 by DMember
Hi, I know what the managed code and unmanaged code is.Managed Code that targets the CLR, and Unmanaged Code that doesn't target.Can someone please explain a bit in detail, that how can we actually create unmanaged code, because whenever we code, we build, run .... but by default it...
30 May 2014 by OriginalGriff
You don't create unmanaged code with .NET - which means C#, VB etc do not create unmanaged code.You create unmanaged code in Native applications, which basically means C++. All you can do is interface with unmanaged code from a C# or VB application.If you want an example of unmanaged...
19 May 2021 by dj4400
Hi, I have a native c++ app. that uses a clr/cli wrapper to call a c# dll function. The solution is built in VS.2017, using the platform toolset of vs2010(v100) and includes the native c++ project, the clr/cli wrapper project and the c# dll...
19 May 2021 by Dave Kreskowiak
That's not an exception. It's just a debugger message that says it cannot load the symbols from the PDB file for the wkernelbase assembly. There's nothing to worry about there. If you want to get rid of it, you can enable automatically...
20 Mar 2017 by VINODKUMAR T
C# Compiler Options[^]For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.The compiler produces executable (.exe) files, dynamic-link libraries (.dll), or code modules (.netmodule).Every compiler option is available in two forms: -option and...
1 Sep 2018 by Member 13969232
I have Database on localhost (xampp, mysql). I have some symbols cyrillics (russian symbols). All fields of database are setting as utf8mb4_general_ci. From Database I receive data to application CLR windows form (visual studio). It's work correctly. If I try change data at database from...
9 Dec 2021 by codefast1993
I have a mixed mode dll (C++/Cli) that is referenced in a C# application. It crashes with the error: name_here.dll has caused an access violation exception(0xC0000005) when trying to read from memory location 0x00000000 on thread 243. What I...
13 Mar 2017 by MK-Gii
Anyone have any ideas if there is a simple way to measure how much memory a certain part of application is consuming?For example I got an application that load text files, processes these and takes another one. I need to measure how much memory the single file processing took.I know I could...
13 Mar 2017 by Dominic Abraham
Have you tried using the below method ?GC.GetTotalMemory(true) This you can use at start / end of the method and get the difference.RegardsDominic
23 Dec 2015 by Member 12093351
Hi,i am creating a Sql CLR stored procedure. The project version in 3.5 Client profile and my sql server is 2008. Previously its working fine.Now i have installed twilio in this project using NuGet package manager(Version 2.8). Now am getting error...
24 Dec 2015 by ZurdoDev
A simple google search shows how to register your assembly. See Exact Help: How to transfer or create CLR stored procedure from one database to other database in sql server[^] for an example.
11 Oct 2013 by Xakzi
Hello!I need some help with editing a code snippet.the code is following:System::String^ basefolder = "Champions\\" + comboBox1->SelectedItem->ToString() + "\\Skins\\"; for each (String^ file in Directory::GetFiles(basefolder,"*.jpg")) { if (pictureBox6->Image !=...
10 Oct 2013 by Sergey Alexandrovich Kryukov
Please use: http://msdn.microsoft.com/en-us/library/system.io.path.getfilenamewithoutextension.aspx[^].But there is another link you really need much more: Microsoft Q209354.—SA
10 Oct 2013 by Homero Rivera
I usually work this out with basic string operations -at times the most reliable.You are using .Net, so you'll need this on top:using namespace System;Create a string called "MyString" and asign it the value of the string in question which in your case will be...
11 Oct 2013 by Xakzi
Solved the coding :)My solution got to this.System::String^ basefolder = "Champions\\" + comboBox1->SelectedItem->ToString() + "\\Skins\\"; for each (String^ file in Directory::GetFiles(basefolder,"*.jpg")) { ...
23 Feb 2011 by Jon_Slaughter
Design a Statemachine in XML and generate a C# code representing it.
7 May 2013 by Aydin Homay
This tip/trick discusses about hosting a Windows Form user control in an MFC dialog box and View windows.
24 Jan 2012 by RedDk
#using using namespace System;int main(){ //Two arrays: __wchar_t and String array^ chararray3 = gcnew array(5); array^ strarray = gcnew array(5); //values into arrays chararray3[0] = L'\u2550'; chararray3[1] =...
24 Jan 2012 by Michael Haephrati
To begin with you should change c++ into cp++ for(cp=0;cp
24 Jan 2012 by Richard MacCutchan
You cannot cast a string to a char. Just because you have a single character in your string does not make it into a character constant, it remains a string but with only one character in it.
8 May 2015 by Pardeep Rajput
How do I add c# class library/ class dll in SQL CLR project ?. I add the class library dll/ class dll but got error in SQL server 2012 during assembly creationAssembly references assembly 'system.runtime.serialization, version=4.0.0.0, culture=neutral, which is not present in the...
9 May 2015 by Sinisa Hajnal
Check this, it might helpSQL Server videos[^]
29 Jul 2015 by TheCaptain10
Hi,I want clear all line in windows form that drawn with graphic method.Here this is the code : Graphics^ pg = CreateGraphics(); Pen^ pen1 = gcnew Pen(Color::Red); pg->DrawLine(pen1, 100, 100, 200, 200);I try do it by Graphic.clear() but it wasn't successful.Please help me!
29 Jul 2015 by himanshu agarwal
You can call Graphics.Clear with background color or call this.Invalidate() method to erase it.