[2092]More incorrect VB code analysis

Found the following:
error1.jpg
The variable templateName is definetly used in the next statement. Another sample for this:

error3.jpg
The variable xlRange is used outside the if-block. On the other hand R# didn't recognize that the last case label is not used.

Another problem i've found was this:
error2.jpg
In this case the VB compiler don't flag an error and correctly calls the Sub Activate(). I'm not sure if VB is too lazy here.

Regards
Klaus

5 comments
Comment actions Permalink

Problem 1: thank you for report, it will be fixed shortly  Problem 2: Not a problem! The assigned "xlRange" is immediately overwritten after Select block  Problem 3: Please could you create small sample solution demonstrating this problem? Thank you in advance

0
Comment actions Permalink

Hi Eugene,

for Problem 3 i just added a line to the sample i sent you a few days before. Just found another problem with analyzing COM-Objects. There is a call to an Excel-Function with named parameters in my application and R# flags them as unknown. I have added a line in the sample too. It seems that R# has problems when function return values are of type Object.

Problem 2 is definetly a error in the code. I have refactored a similar piece some times ago and forgotten to copy the code to this place. Thanks for putting my attention on this :)

Regards
Klaus



Attachment(s):
ExcelCom.zip
0
Comment actions Permalink

Just found another problem with XML comments. I have declared an Event and put a comment on it. In the param-tag R# says "Cannot resolve symbol". I have updated my sample solution to demonstrate the problem (See Class1).

Regards
Klaus



Attachment(s):
ExcelCom.zip
0
Comment actions Permalink

All problems in this sample are fixed, except for the "Activate" method call. Here VB compiler behavior differs from VB specification, and this requires extra investigations.

0
Comment actions Permalink

thanks for the feedback, hope a new EAP build will be published soon because the red error marks in the source always irritating me.

0

Please sign in to leave a comment.