clr

Does a thread start have implicit memory barrier?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 12:28:49
问题 i.e. when I start a new thread, is it safe to read any variables initialized before the thread start from the newly started thread? UPD why I'm asking? Because some developers assume that it does have, and don't use any explicit memory barriers there. And I couldn't reproduce any bugs in that code. However, documentation http://msdn.microsoft.com/en-us/library/ms686355(v=vs.85).aspx doesn't say this is safe. 回答1: Yes, the operating system provides the implicit barrier. It can't get the thread

T-SQL and CLR types for return value do not match

旧巷老猫 提交于 2019-12-23 12:28:44
问题 I'm trying to create a custom SQL Function by CLR Integration but I'm having a T-SQL and CLR types mismatch error. DLL: Imports System Imports System.Data Imports Microsoft.SqlServer.Server Public Class Encrypter_Decrypter <SqlFunction(DataAccess:=DataAccessKind.Read)> _ Public Shared Function EncryptString(ByVal strItem As String) Dim strPassPhrase As String = "***********" Dim strInitVector As String = "***********" Dim objEncryption = New PCI.Encryption() objEncryption.Initialise

Why did the BeforeFieldInit behavior change in .NET 4?

一世执手 提交于 2019-12-23 11:24:09
问题 In C# 4, the behavior of types without the beforefieldinit flag was changed, so now a type initializer can call before first use of any static field of the class. My questions are why has the C#/.NET team changed that behavior? What is the main reason? Can you show any practical example where this change makes any sense? 回答1: The behaviour has always been within the bounds of what's documented - it's just that it changed from being eager to lazy in .NET 4. I suspect the JIT team managed to

Using .Net 3.5 assemblies SQL 2005 CLR?

落爺英雄遲暮 提交于 2019-12-23 10:06:50
问题 I have a CLR stored procedure that references an assembly created in VS 2008 that uses Linq. Lets call this assembly 'MyLib'. I can't seem to get 'MyLib' into my SQL 2005 database. I do the following: CREATE ASSEMBLY [MyLib] FROM 'C:\MyLib\bin\Release\MyLib.dll' WITH PERMISSION_SET = UNSAFE GO But I get the error: Assembly 'MyLib' references assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server

Using .Net 3.5 assemblies SQL 2005 CLR?

有些话、适合烂在心里 提交于 2019-12-23 10:05:48
问题 I have a CLR stored procedure that references an assembly created in VS 2008 that uses Linq. Lets call this assembly 'MyLib'. I can't seem to get 'MyLib' into my SQL 2005 database. I do the following: CREATE ASSEMBLY [MyLib] FROM 'C:\MyLib\bin\Release\MyLib.dll' WITH PERMISSION_SET = UNSAFE GO But I get the error: Assembly 'MyLib' references assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server

MissingMethodException when referencing Microsoft.Build and System.IO.Compression

半腔热情 提交于 2019-12-23 09:59:06
问题 I have a "Classic Desktop" .NET project which references Microsoft.Build 15.1 from NuGet and System.IO.Compression / System.IO.Compression.FileSystem from the .NET SDK / GAC. I'm trying to upgrade this to Microsoft.Build 15.3. Microsoft.Build 15.3 introduces a dependency on System.IO.Compression 4.1.2.0. The version of System.IO.Compression in the .NET Framework is 4.0.0.0. If I compile like this, I get a warning about being unable to resolve assembly conflicts, but my code works: warning

Jitter logic to remove unbox_any

妖精的绣舞 提交于 2019-12-23 09:50:01
问题 I'm investigating the execution of this C# code: public static void Test<T>(object o) where T : class { T t = o as T; } The equivalent IL code is: .method public static void Test<class T>(object A_0) cil managed { // Code size 13 (0xd) .maxstack 1 .locals init (!!T V_0) IL_0000: ldarg.0 IL_0001: isinst !!T IL_0006: unbox.any !!T IL_000b: stloc.0 IL_000c: ret } // end of method DemoType::Test Based on this answer (unnecessary unbox_any), can anyone explain to me what the exact logic the Jitter

What is the difference between VirtualMemorySize64 and PrivateMemorySize64

拜拜、爱过 提交于 2019-12-23 09:25:49
问题 I do not understand the difference between Process.PrivateMemorySize64 and Process.VirtualMemorySize64 I have created a simple console application which allocates 10 times 10 megabyte into an byte array. const int tenMegabyte = 1024*1024*10; long allocatedMemory = 0; List<byte[]> memory = new List<byte[]>(); for (int i = 0; i < 10; i++) { allocatedMemory += tenMegabyte; Console.WriteLine("Allocated memory: " + PrettifyByte(allocatedMemory)); Console.WriteLine("VirtualMemorySize64: " +

Mixed C++/CLI TypeLoadException Internal limitation: too many fields

寵の児 提交于 2019-12-23 09:24:45
问题 On a quest to migrate some new UI into Managed/C# land, I have recently turned on Common Language Runtime Support (/clr) on a large legacy project, which uses MFC in a Shared DLL and relies on about a dozen other projects within our overall solution. This project is the core of our application, and would drive any managed UI code that is produced (hence the need to turn on clr support for interop). After fixing a ton of little niggly errors and warnings, I finally managed to get the

Library to generate .NET XmlDocument from HTML tag soup

无人久伴 提交于 2019-12-22 19:54:05
问题 I'm looking for a .NET library that can generate a clean Xml tree, ideally System.Xml.XmlDocument, from invalid HTML code. I.E. it should make the kind of best effort guesses, repairs, and substitutions browsers do when confronted with this situation, and generate a pretend XmlDocument. The library should also be well-maintained. :) I realize this is a lot (too much?) to ask, and I would appreciate any useful leads. There seem to be a fair number of implementations of this for Java, but I