If you change the condition of the existing ternary expression from 
(mtne.Node!=null) to (mtne.Node!=null && mtne.Node.ToString()!=null), it fixes 
the problem.

Sam

-----Original Message-----
From: Johannes Luber [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 28, 2008 3:45 PM
To: Sam Harwell
Cc: antlr-interest
Subject: Re: [antlr-interest] C# target: .NET Frameworkbug causing 
NullReferenceException, must use this workaround

Sam Harwell schrieb:
> 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

You mean I have to add a ToString() to mtne.Node?

Johannes
> 
> -----Original Message-----
> From: Johannes Luber [mailto:[EMAIL PROTECTED] 
> 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:* [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] *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
>>
> 
> 
> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
> 


List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to