clr

Resolving MSB3247 - Found conflicts between different versions of the same dependent assembly

◇◆丶佛笑我妖孽 提交于 2019-12-17 03:44:27
问题 A .NET 3.5 solution ended up with this warning when compiling with msbuild. Sometimes NDepend might help out but in this case it didn't give any further details. Like Bob I ended up having to resort to opening each assembly in ILDASM until I found the one that was referencing an older version of the dependant assembly. I did try using MSBUILD from VS 2010 Beta 2 (as the Connect article indicated this was fixed in the next version of the CLR) but that didn't provide any more detail either

Stack capacity in C#

天大地大妈咪最大 提交于 2019-12-17 02:31:37
问题 Could someone tell me what the stack capacity is in C#. I am trying to form a 3D mesh closed object using an array of 30,000 items. 回答1: The default stack size for a .NET application is 1 MB (default is 256 KB for 32-bit ASP.NET apps and 512 KB for 64-bit ASP.NET apps), but you can change that. For the application you can change the default size by modifying the PE header of the executable. For threads you create, you can use the constructor overload that takes a stack size. But as Anton

LINQ on the .NET 2.0 Runtime

天涯浪子 提交于 2019-12-17 00:24:32
问题 Can a LINQ enabled app run on a machine that only has the .NET 2.0 runtime installed? In theory, LINQ is nothing more than syntactic sugar, and the resulting IL code should look the same as it would have in .NET 2.0. How can I write LINQ without using the .NET 3.5 libraries? Will it run on .NET 2.0? 回答1: There are some "Hacks" that involve using a System.Core.dll from the 3.5 Framework to make it run with .net 2.0, but personally I would not want use such a somewhat shaky foundation. See here

How to get TypeDef from TypeSpec

怎甘沉沦 提交于 2019-12-14 03:58:03
问题 I'm trying to implement managed debugger looking at MDBG sample. Currently I'm stuck trying to get base class hierarchy methods using IMetaDataImport. EnumMethods, that I'm using, enumerates MethodDef tokens representing methods of the specified type . But I want to enumerate all the methods in class hierarchy. To do that I'm using GetTypeDefProps, that returns ptkExtends, which is token representing the base class. The problem is that base class could be represented by TypeDef, TypeRef or

Using Static Constructor (Jon Skeet Brainteaser)

徘徊边缘 提交于 2019-12-14 03:43:13
问题 As a relative newbie I try to read as much as I can about a particular subject and test/write as much code as I can. I was looking at one of Jons Brainteasers (question #2) and my output was different than the answer. Which makes brings me here to ask if something has changed in recent versions and to see what output others are getting from this code. The question is, "What will be displayed, why, and how confident are you?" using System; class Foo { static Foo() { Console.WriteLine ("Foo");

Returning string from function having multiple NULL '\0' in C

时间秒杀一切 提交于 2019-12-14 02:58:01
问题 I am compressing string. And the compressed string sometimes having NULL character inside before the end NULL. I want to return the string till the end null.But the compressor function is returning the sting till the occurring of the first NULL. Please help me. char* compressor(char* str) { char *compressed_string; //After some calculation compressed_string="bk`NULL`dk";// at the last here is automatic an NULL we all know return compressed_string; } void main() { char* str; str=compressor(

How do I obtain a list of the application domains my application has created?

拈花ヽ惹草 提交于 2019-12-14 02:07:33
问题 I have a service app that creates AppDomain's during the course of its use for long running tasks. I've been tracking these by storing them in a Hashtable with a unique ID. After a task is completed the service app then unloads the AppDomain allocated to that task and then it's removed it from the appdomain Hashtable. Purely from a sanity checking point of view, is there a way I can query the CLR to see what app domains are still loaded by the creating app domain (i.e. so I can compare the

Compile Time Conversion of uint to int in C#

ぃ、小莉子 提交于 2019-12-14 00:56:54
问题 I've got an enum like this in an old piece of code: [Flags] public enum Example: uint { Foo = 0x00000001, Bar = 0xC0000000 } Now, FxCop is complaining about this enum using uint rather than int as it's backing field. (And I've been tasked with getting this code as FxCop clean as possible...) But there is an existing enum value which uses the high order bit of the enum, and I can't change this because it has been persisted into an on-disk format. When I try to compile this, the C# compiler

How to Combine Chilkat Library into SQL Server CLR

南楼画角 提交于 2019-12-13 19:12:38
问题 I'm trying to use the Chilkat encryption library in SQL Server 2008 via a CLR assembly. Because of how the Chilkat library is put together (see their message below), I can't do this directly and need to create a wrapper-class that references the Chilkat library and yet is fully-managed the way SQL Server requires. Below is the response from Chilkat when I asked about how to interface their library directly by SQL server (the short version is that you can't). The Chilkat .NET assembly is a

Binding forms ComboBox to DataTable DataContext

江枫思渺然 提交于 2019-12-13 18:00:48
问题 I'm usually able to solve my problems with about five minutes of searching but this one has taken several days with no results, so I'll try posing the question. I have a Form whose DataContext is set to a datatable (would prefer LINQ to SQL but I am stuck w/ Sybase which lacks good support for modern entity frameworks.) I have a combo box sourced by another datatable that should update a column on the forms data table but I can't seem to get the binding for SelectedValue to work correctly. I