C# Compiler bug 2
-
In this case, the code that causes it is illegal - but that is no excuse for the compiler to crash with a "Report crash?" dialog! It happens when you try to use an anonymous delegate as an argument to an Attribute, and the delegate returns something. Like so:
[Obsolete(delegate () { return null; })]
void testfunction() {}This happens in 2005 Express, not sure about 2008 or non-Express.
-
In this case, the code that causes it is illegal - but that is no excuse for the compiler to crash with a "Report crash?" dialog! It happens when you try to use an anonymous delegate as an argument to an Attribute, and the delegate returns something. Like so:
[Obsolete(delegate () { return null; })]
void testfunction() {}This happens in 2005 Express, not sure about 2008 or non-Express.
Confirmed under VS2005
Bar fomos edo pariyart gedeem, agreo eo dranem abal edyero eyrem kalm kareore
-
In this case, the code that causes it is illegal - but that is no excuse for the compiler to crash with a "Report crash?" dialog! It happens when you try to use an anonymous delegate as an argument to an Attribute, and the delegate returns something. Like so:
[Obsolete(delegate () { return null; })]
void testfunction() {}This happens in 2005 Express, not sure about 2008 or non-Express.
And that's subtle... how? :confused: P.S. And how did you fix it?
-
In this case, the code that causes it is illegal - but that is no excuse for the compiler to crash with a "Report crash?" dialog! It happens when you try to use an anonymous delegate as an argument to an Attribute, and the delegate returns something. Like so:
[Obsolete(delegate () { return null; })]
void testfunction() {}This happens in 2005 Express, not sure about 2008 or non-Express.
Doesn't crash in Visual Studio 2008 SP1.
-
In this case, the code that causes it is illegal - but that is no excuse for the compiler to crash with a "Report crash?" dialog! It happens when you try to use an anonymous delegate as an argument to an Attribute, and the delegate returns something. Like so:
[Obsolete(delegate () { return null; })]
void testfunction() {}This happens in 2005 Express, not sure about 2008 or non-Express.
harold aptroot wrote:
[Obsolete(delegate () { return null; })] void testfunction() {}
Who would need something like this and how did you spot it?! Ideed, putting an anymous method as a parameter of Attributte is hard to presume for the compiler creators...
Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
-
And that's subtle... how? :confused: P.S. And how did you fix it?
PIEBALDconsult wrote:
P.S. And how did you fix it?
With a terrible workaround, that doesn't make me happy at all.. Instead of passing a delegate as argument I now have a static method in the attribute that lets you register one with a certain type. It's not a complete workaround however, this way a certain delegate is always bound to a certain type, for every field/property. Even name/type pairs wouldn't have to be unique, and I wouldn't like to need lots of reflection..
-
In this case, the code that causes it is illegal - but that is no excuse for the compiler to crash with a "Report crash?" dialog! It happens when you try to use an anonymous delegate as an argument to an Attribute, and the delegate returns something. Like so:
[Obsolete(delegate () { return null; })]
void testfunction() {}This happens in 2005 Express, not sure about 2008 or non-Express.