Author |
Topic  |
|
pwaugh
Ketchup Master
   
USA
68 Posts |
Posted - Mar 09 2008 : 06:20:55 AM
|
Ok, being new to C# (usually do C++), I'm playing around and in the Game class, I have this method:
public bool PullOutBooks(Player player)
{
// Pull any books in players hand
List<Card.Values> booksPulled = player.PullOutBooks();
// Add pulled books to books dictionary
foreach (Card.Values value in booksPulled)
books.Add(value, player);
if (player.CardCount == 0)
return true;
return false;
}
and as you can see an identically named method in the player class.
Normally, VAX colors all my methods Red, but this one is not colored Red. Moreover, when I change the name to something else, it does color it Red!
Is this a hint from VAX that I'm doing something wrong?
Patrick
|
Programming in C++
VA_X.dll 10.4.1626.0 Built 2008.01.17
(1-user license) Support ends 2009.01.29
DevEnv.exe version 9.0.21022.8 msenv.dll version 9.0.21022.8 Comctl32.dll version 6.0.2900.2982 Windows XP 5.1 Build 2600 Service Pack 2 Single processor Platform: Win32
|
|
kevinsikes
Tomato Guru
    
USA
271 Posts |
Posted - Mar 10 2008 : 02:30:26 AM
|
Hi Patrick,
I rigged up a few support classes around your snippet to create a minimally reproducible example. Both the Player.PullOutBooks and Game.PullOutBooks methods are colored correctly. I am using VS2005 SP1 on Windows XP SP2 with Visual Assist X 1626. Can you try boiling down your code to the minimum needed to reproduce the problem and let us know what you find? Thanks.
 |
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
Edited by - kevinsikes on Mar 10 2008 02:34:38 AM |
 |
|
pwaugh
Ketchup Master
   
USA
68 Posts |
Posted - Mar 11 2008 : 9:27:14 PM
|
Well, I'm using VS 2008 for starters.
However, I have narrowed it down. Earlier in class I have this method:
private void Deal()
{
stock.Shuffle();
for (int i = 0; i < 5; i++)
{
foreach (Player player in players) // Deal five cards to each player
player.TakeCard(stock.Deal());
}
foreach (Player player in players)
PullOutBooks(player); // PullOutBooks() in hands
}
If I comment out the call to the PullOutBooks() near the end, then suddenly the method is colored Red!
Patrick
|
Programming in C++
VA_X.dll 10.4.1626.0 Built 2008.01.17
(1-user license) Support ends 2009.01.29
DevEnv.exe version 9.0.21022.8 msenv.dll version 9.0.21022.8 Comctl32.dll version 6.0.2900.2982 Windows XP 5.1 Build 2600 Service Pack 2 Single processor Platform: Win32
|
 |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Mar 12 2008 : 09:58:27 AM
|
The problem is that foreach statement. I have managed to simplify the test down to:
class Game
{
private void Deal()
{
List<String> players = new List<String>();
foreach (String player in players)
PullOutBooks(player); // PullOutBooks() in hands
}
public bool PullOutBooks(String player)
{
return true;
}
}
For me, if I change the foreach statement to:
foreach (String player in players)
{
PullOutBooks(player); // PullOutBooks() in hands
}
the problem goes away. Can you try the same change please, and see if this fixes the problem for you?
case=14446 |
zen is the art of being at one with the two'ness |
 |
|
pwaugh
Ketchup Master
   
USA
68 Posts |
Posted - Mar 12 2008 : 12:56:13 PM
|
I'm not sure I follow what change you want me to try. You want me to make player a List<String> type instead of a Player type?
|
Programming in C++
VA_X.dll 10.4.1626.0 Built 2008.01.17
(1-user license) Support ends 2009.01.29
DevEnv.exe version 9.0.21022.8 msenv.dll version 9.0.21022.8 Comctl32.dll version 6.0.2900.2982 Windows XP 5.1 Build 2600 Service Pack 2 Single processor Platform: Win32
|
 |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Mar 12 2008 : 2:27:35 PM
|
Apologies, that was not as clear as it could have been. In your function:
private void Deal()
{
stock.Shuffle();
for (int i = 0; i < 5; i++)
{
foreach (Player player in players) // Deal five cards to each player
player.TakeCard(stock.Deal());
}
foreach (Player player in players)
{
PullOutBooks(player); // PullOutBooks() in hands
}
} try adding curly brackets after the foreach line like this. Hopefully that will fix the problem for you. |
zen is the art of being at one with the two'ness |
 |
|
pwaugh
Ketchup Master
   
USA
68 Posts |
Posted - Mar 12 2008 : 3:00:57 PM
|
That did it! Glad we were able to identify where VAX was having problems. =)
This is so minor, I'm embarrassed pointing it out. :D
There are two things in life I couldn't live without: My Blackberry, and my VAX!
|
Programming in C++
VA_X.dll 10.4.1626.0 Built 2008.01.17
(1-user license) Support ends 2009.01.29
DevEnv.exe version 9.0.21022.8 msenv.dll version 9.0.21022.8 Comctl32.dll version 6.0.2900.2982 Windows XP 5.1 Build 2600 Service Pack 2 Single processor Platform: Win32
|
 |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Mar 12 2008 : 3:19:49 PM
|
It is fairly minor, and easy to fix when you know the fix 
Thank you for pointing it out. It is important to try and fix these "little" problems, since each one we fix makes VA a better product  |
zen is the art of being at one with the two'ness |
 |
|
Dany
Senior Member
  
Germany
41 Posts |
Posted - Jul 24 2009 : 09:34:45 AM
|
Hmmm, I know that this is a rather old topic (and thus maybe fixed).
But in C# wit VAX Build 1727 I can see something similar.
When I use a selfmade method directly in a foreach statement (without brackets), all references are shown in black. When I put the method call in brackets I get the desired syntax coloring (orange in my case).
ReplaceReferences(resXFile);
foreach (string resXFile in resXFiles)
ReplaceReferences(resXFile);
After the change:
ReplaceReferences(resXFile);
foreach (string resXFile in resXFiles)
{
ReplaceReferences(resXFile);
}
|
Dany
// using VAX in C# of VS2010 SP1 (en), Win 7 SP1 (de)
|
 |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Jul 24 2009 : 2:06:44 PM
|
I am seeing the same effect here. Thank you for the clear description.
case=14446 |
zen is the art of being at one with the two'ness |
 |
|
support
Whole Tomato Software
    
5566 Posts |
Posted - Jul 20 2011 : 02:10:30 AM
|
case=14446 is fixed in build 1854 |
Whole Tomato Software, Inc. |
 |
|
|
Topic  |
|