There is a bug in the C# complirer which Visual Studio crashing. The bug happends when writing a const delegate assignment within the a structure. for example:
public struct Temp
{
private const Action<bool> Foo = delegate() { return false; };
}
I searched everywhere to find a link for a bug report. I even called the support team. Unfortunately I couldn't do it online because the the ActiveX control on the web site failed to locate the product id. I even tried it manually but it gives me "Invalid produc id" error.
I'm using VS2005 on Vista.
FYI, replacing the const with static will solve the problem.
Thanks,
/Ali
(mailto:alij@alcor.concordia.ca)

C# compiler BUG - const delegate assignment within a structure definition
acf
Flakky
Lama Karmi
Hi,
I tried this on Orcas compiler and the ICE is not there but an error appears saying" A const field of a reference type other than string can only be initialized with null".
This seems to be the solution to the bug, I don't know why the solution didn't make it to SP1.
VThornheart
libyan
donkaiser
PSernz
Thanks for your notes. My point is: although the const shouldn't be used for the declaration, the IDE shouldn't crash.
BTW, I was able to send it as a feed back using the following link which I got from rgerbig.
http://lab.msdn.microsoft.com/productfeedback/default.aspx
Thanks.