[antlr-interest] C# target: .NET Frameworkbug causing NullReferenceException, must use this workaround

Sam Harwell sharwell at pixelminegames.com
Wed Aug 27 17:59:08 PDT 2008


Strangely enough, your fix highlights why the bug in the Framework probably hasn't been fixed to date. The problem only occurs if mtne.Node is not null, so your current code change has no effect on the situation.

Sam

-----Original Message-----
From: Johannes Luber [mailto:jaluber at gmx.de] 
Sent: Saturday, August 09, 2008 3:10 PM
To: Sam Harwell
Cc: antlr-interest
Subject: Re: [antlr-interest] C# target: .NET Frameworkbug causing NullReferenceException, must use this workaround

Sam Harwell schrieb:
> I’m with Jim on this – if I had only sent you a link to the bug report 
> at MS you would have figured out something similar to what I wrote 
> anyway. When you make the change, make sure to comment that you’re 
> working around anti-documented behavior so no one wants to change it later.

I decided to use a ternary operator here, because I find it strange that 
a string null is handled differently than an object null (as shown in 
the bugfix which Sam posted). That way I'm safe regarding this bug and 
any possible problem regarding the lack of the license.

Johannes
> 
>  
> 
> The standard says this at the end of page 201 (section 14.7.4 Addition 
> operator):
> 
> “If an operand of string concatenation is null, an empty string is 
> substituted.”
> 
>  
> 
> Sam
> 
>  
> 
> *From:* antlr-interest-bounces at antlr.org 
> [mailto:antlr-interest-bounces at antlr.org] *On Behalf Of *Jim Idle
> *Sent:* Saturday, August 09, 2008 11:22 AM
> *To:* antlr-interest
> *Subject:* Re: [antlr-interest] C# target: .NET Frameworkbug causing 
> NullReferenceException, must use this workaround
> 
>  
> 
> On Sat, 2008-08-09 at 15:05 +0200, Johannes Luber wrote:And did you sign 
> the ANTLR Contribution
> 
>  
> 
> License? Otherwise I can't use your bugfix.
> 
> 
> I don't think that is true - it is a few lines that you are going to 
> type in yourself, probably fairly differently. Hence this is covered by 
> your own signature I should think. I rarely (ok, never) type in a bug 
> fix that someone sends in, I just use it as an example of HOW something 
> MIGHT be fixed IF the behavior it purports to fix IS in fact the 
> behavior that is wrong ;-)
> 
> Jim
> 



More information about the antlr-interest mailing list