csc

'Arrays as attribute arguments is not CLS-compliant' warning, but no type information given

♀尐吖头ヾ 提交于 2019-12-01 15:50:15
When compiling my solution, I get several warnings of the following: warning CS3016: Arrays as attribute arguments is not CLS-compliant No other information on what type is not compliant is given. In my projects I have some attributes that take params array arguments in their constructors, but they are all internal, and that shouldn't affect CLS-compliance. Why is this warning being given, and what type is it being given on? CS3016 . If you have an attribute which takes an array as argument and the project is marked as CLSCompliant you will get this warning. Brent I ran into this today. I had

Including FSharp.Core in a C# project: resolving type collisions

╄→гoц情女王★ 提交于 2019-12-01 14:34:02
问题 I'm using some F# types (Matrix et al) from C# and so I need to reference the FSharp.Core assembly in my C# project. So far, so good. However, there are apparently some types defined in mscorlib.dll (v4) which are "duplicated" in FSharp.Core (v2), like System.Tuple and System.IObservable . I can't understand why this is in .Net 4. Matt Ellis specifically said they would be removed in his MSDN article: One language suffering that [duplication] problem was F#, which previously had defined its

How to generate IL source code with csc (C# compiler) or dmcs (mono C# compiler)?

六眼飞鱼酱① 提交于 2019-12-01 06:56:39
gcc has an option of -s to generate assembly source code. Does csc (MS C# compiler) or dmcs (mono C# compiler) have equivalence? I mean do those compilers provide an option to generate IL source code that can be read not the execution binary? It's very easy to get to the IL: just use ildasm . The /text option prints the result to the console, which you can divert to a file. A C# compiler always generates IL ( CIL in the case for .net), because thats the way .net works, but if you mean you want to precompile this in to machine code to speed up execution you can use ngen.exe (see HERE ). If you

How to generate IL source code with csc (C# compiler) or dmcs (mono C# compiler)?

你说的曾经没有我的故事 提交于 2019-12-01 05:12:10
问题 gcc has an option of -s to generate assembly source code. Does csc (MS C# compiler) or dmcs (mono C# compiler) have equivalence? I mean do those compilers provide an option to generate IL source code that can be read not the execution binary? 回答1: It's very easy to get to the IL: just use ildasm. The /text option prints the result to the console, which you can divert to a file. 回答2: A C# compiler always generates IL (CIL in the case for .net), because thats the way .net works, but if you mean

Work-around for C# CodeDom causing stack-overflow (CS1647) in csc.exe?

不羁的心 提交于 2019-12-01 04:46:29
I've got a situation where I need to generate a class with a large string const. Code outside of my control causes my generated CodeDom tree to be emitted to C# source and then later compiled as part of a larger Assembly. Unfortunately, I've run into a situation whereby if the length of this string exceeds 335440 chars in Win2K8 x64 (926240 in Win2K3 x86), the C# compiler exits with a fatal error: fatal error CS1647: An expression is too long or complex to compile near 'int' MSDN says CS1647 is "a stack overflow in the compiler" (no pun intended!). Looking more closely I've determined that the

Work-around for C# CodeDom causing stack-overflow (CS1647) in csc.exe?

牧云@^-^@ 提交于 2019-12-01 01:48:48
问题 I've got a situation where I need to generate a class with a large string const. Code outside of my control causes my generated CodeDom tree to be emitted to C# source and then later compiled as part of a larger Assembly. Unfortunately, I've run into a situation whereby if the length of this string exceeds 335440 chars in Win2K8 x64 (926240 in Win2K3 x86), the C# compiler exits with a fatal error: fatal error CS1647: An expression is too long or complex to compile near 'int' MSDN says CS1647

List of breaking changes in Roslyn

回眸只為那壹抹淺笑 提交于 2019-12-01 00:08:40
After switching to Visual Studio 2015, we have noticed that some changes made to how lambdas are compiled to MSIL in Roslyn (described in this thread and on GitHub ) introduce runtime failures under certain conditions. Since Roslyn is obviously the future of .NET, we would like to switch to this technology, but it seems that all legacy code which has been running in production (and where we have a fair degree of confidence it works correctly) is now prone to new runtime failures. These are several libraries which are impacted by this issue also (like Moq, for example ). We already skipped the

Why is the .ctor() created when I compile C# code into IL?

你说的曾经没有我的故事 提交于 2019-11-30 17:35:54
With this simple C# code, I run csc hello.cs; ildasm /out=hello.txt hello.exe . class Hello { public static void Main() { System.Console.WriteLine("hi"); } } This is the IL code from ildasm. .class private auto ansi beforefieldinit Hello extends [mscorlib]System.Object { .method public hidebysig static void Main() cil managed { .entrypoint // Code size 13 (0xd) .maxstack 8 IL_0000: nop IL_0001: ldstr "hi" IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c: ret } // end of method Hello::Main .method public hidebysig specialname rtspecialname instance void .ctor(

Why is the .ctor() created when I compile C# code into IL?

孤街浪徒 提交于 2019-11-30 16:37:42
问题 With this simple C# code, I run csc hello.cs; ildasm /out=hello.txt hello.exe . class Hello { public static void Main() { System.Console.WriteLine("hi"); } } This is the IL code from ildasm. .class private auto ansi beforefieldinit Hello extends [mscorlib]System.Object { .method public hidebysig static void Main() cil managed { .entrypoint // Code size 13 (0xd) .maxstack 8 IL_0000: nop IL_0001: ldstr "hi" IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c: ret

Visual Studio gone bonkers: 'The directory name is invalid' error when trying to compile

你说的曾经没有我的故事 提交于 2019-11-30 08:50:39
For some very odd reason, my Visual Studio 2008, when trying to compile a C# project, tries to write the output of the executable to a directory with the same name as an executable, at least it seems that that's what the error message implies. After running Compile on any of my projects, CSC.EXE reports the following compiler error: Could not write to output file 'D:\Projects\Examples\StringBuilderVsString\obj\Release\StringBuilderVsString.exe' -- 'The directory name is invalid. ' When I look inside obj\Release or obj\Debug all intermediate resources, like StringBuilderVsString.pdb are