clr

BOO Vs IronPython

跟風遠走 提交于 2019-12-03 05:10:38
What is the difference between IronPython and BOO ? Is there a need for 2 Python-like languages? IronPython is designed to be a faithful implementation of Python on the .NET platform. Version 1 targets Python 2.4 for compatibility, and version 2 targets version 2.5 (although most of the Python standard library modules implemented in C aren't supported). Boo 's stated aim is to be a "wrist-friendly [dynamic] language for the CLI." It takes a lot of inspiration from Python, but diverges on four main points: It's designed specifically to take good advantage of the .NET platform The designer

CLR hosting exception handling in a non-CLR-created thread

青春壹個敷衍的年華 提交于 2019-12-03 05:03:55
The issue: An unhandled exception in a thread entering the CLR from unmanaged code does not trigger the "normal" unhandled exception CLR processing. In the code below calling CSSimpleObject.GetstringLength() from C++ with "1" throws an exception in the calling thread (non-CLR-created thread), "2" throws an exception in a new Thread() (CLR-created thread). In case "1" CurrentDomain_UnhandledException() is never called. The Application Domain and the process will stay loaded and running, you will only get a FAILED. In case "2" (expected behavior) CurrentDomain_UnhandledException() is called. The

Converting bool expression to char in c#

落爺英雄遲暮 提交于 2019-12-03 04:34:26
I passed .NET quiz, when I met a question like below one. Char ch = Convert.ToChar('a' | 'e' | 'c' | 'a'); In console we can see that output for ch variable is g . Can someone describe what is happening ? Thanks! This is not what it looks like at first spot. It is more of binary calculations on the int representation of these Char : Here is a full article explaining this with examples: Article So the binary result for the bitwise Or of these 'a' | 'e' | 'c' | 'a' is 103 . If you Convert that to Char, it is g Edit: I see this answer took more attention than I though it deserves more details.

Why does 'unbox.any' not provide a helpful exception text the way 'castclass' does?

不羁岁月 提交于 2019-12-03 04:34:26
To illustrate my question, consider these trivial examples (C#): object reference = new StringBuilder(); object box = 42; object unset = null; // CASE ONE: bad reference conversions (CIL instrcution 0x74 'castclass') try { string s = (string)reference; } catch (InvalidCastException ice) { Console.WriteLine(ice.Message); // Unable to cast object of type 'System.Text.StringBuilder' to type 'System.String'. } try { string s = (string)box; } catch (InvalidCastException ice) { Console.WriteLine(ice.Message); // Unable to cast object of type 'System.Int32' to type 'System.String'. } // CASE TWO: bad

C# casting to nullable type?

丶灬走出姿态 提交于 2019-12-03 04:21:56
Beyond the regular boring difference between Cast and As if i know that apple is a Fruit so I can use (Fruit)apple - and it throws an exception if it aint as value can be checked against null to see if succeeded [won't throw Exception...] However Ive been reading @EricLippert article about this and there was a nice sample about Nullable Value Types : short? s = (short?)123; int? i = s as int?; this won't compile... Cannot convert type 'short?' to 'int?' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Fine. so why this : short? s

Using System.Threading.Tasks.Parallel create new thread in the thread pool?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 03:36:00
Maybe I did not understand it right ... all the Parallel class issue :( But from what I am reading now, I understand that when I use the Parallel I actually mobilize all the threads that exists in the threadPool for some task/mission. For example : var arrayStrings = new string[1000]; Parallel.ForEach<string>(arrayStrings, someString => { DoSomething(someString); }); So the Parallel.ForEach in this case is mobilizing all the threads that exists in the threadPool for the 'DoSomething' task/mission. But does the call Parallel.ForEach will create any new thread at all? Its clear that there will

MSSQL 2012 creating CLR triggers for WCF fails

不羁的心 提交于 2019-12-03 02:55:50
I've created system that uses CLR triggers to connect to WCF server and notify it about changes in DB. It runs ok on SQL server 2008 R2. Now im trying to migrate on SQL Server 2012. To use WCF i need to load SMDiagnostics.dll assembly along the others. Ive checked that clr is enabled in db , and set trustworthy to be "on", ive disabled WCF debuging, ive checked that SQL server runs under Local System account so there is no problems with permissions. Now my problem is that when i run following command IF NOT EXISTS (SELECT * FROM sys.assemblies asms WHERE asms.name = N'SMdiagnostics') create

Mixing .NET 3.5 with 4/4.5 assemblies in the same process

久未见 提交于 2019-12-03 02:54:26
问题 I'd like to migrate a .NET 3.5 WinForms based application to the latest .NET version (4.5). The application uses "external" components (can be thought of as plugins) that are also currently .NET 3.5 based. I'd like to know what runtime/core libraries are used in case we convert ONLY THE APPLICATION to compile using .NET 4.5? Should this scenario properly work? (loading .NET 3.5 assemblies in a 4.5 process)? * The plugin assemblies are loaded via reflection. How does the CLR runtime handle

#include <comutil.h> cause errors

拟墨画扇 提交于 2019-12-03 02:31:21
VS 2010 C++ CLR Library project, errors on adding comutil.h library > Error 20 error LNK2001: unresolved > external symbol "extern "C" long > __stdcall VariantCopy(struct tagVARIANT *,struct tagVARIANT const > *)" (?VariantCopy@@$$J18YGJPAUtagVARIANT@@PBU1@@Z) D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET > Error 18 error LNK2001: unresolved > external symbol "extern "C" void > __stdcall VariantInit(struct tagVARIANT *)" > (?VariantInit@@$$J14YGXPAUtagVARIANT@@@Z) D:\Projects\AL\Service\ncFlow\ncOPClient.NET\Stdafx.obj ncOPClient.NET > Error 13 error LNK2001:

How is it that an enum derives from System.Enum and is an integer at the same time?

时间秒杀一切 提交于 2019-12-03 02:16:33
问题 Edit : Comments at bottom. Also, this. Here's what's kind of confusing me. My understanding is that if I have an enum like this... enum Animal { Dog, Cat } ...what I've essentially done is defined a value type called Animal with two defined values, Dog and Cat . This type derives from the reference type System.Enum (something which value types can't normally do—at least not in C#—but which is permitted in this case), and has a facility for casting back and forth to/from int values. If the way