Game authors and players, please read this thread!

Author Topic: Conflict between the "GUI" namespace and the "GUI" type  (Read 561 times)  Share 

Monsieur OUXX

  • Mittens Serf
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
In the Editor's source, there are two things named "GUI" :
- the type: AGS.Types.GUI
- the namespace: AGS.Editor.GUI

I've tried building the solution with Visual Studio 2010 Ultimate, and it fails to resolve the conflict: It says "AGS.Editor.GUI is a namespace but is used as a type", for example when compiling GUIEditor.cs
This is worked around by explicitly replacing "GUI" with "AGS.Types.GUI" in the source. For example : "private GUI _gui = null;" becomes "private AGS.Types.GUI _gui = null;"

Am I missing something? Is it the newest VS being stricter, or is it a setting to change?
     

monkey_05_06

  • AGS Project Admins
  • Has left the building.
Re: Conflict between the "GUI" namespace and the "GUI" type
« Reply #1 on: 03 May 2012, 15:11 »
I didn't think you could use namespaces that way.

Anyway, it builds fine under VS2008 Express. (roll)
Let's be honest. Most people suck at coding. I suck at coding, but at least my code is readable. To Hell with anyone too lazy to maintain consistent formatting in their code. I could deal with bad interfaces and structure if I could even read your horrible code. And that's putting it nicely. -monkey

Monsieur OUXX

  • Mittens Serf
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: Conflict between the "GUI" namespace and the "GUI" type
« Reply #2 on: 03 May 2012, 15:58 »
I didn't think you could use namespaces that way.
I didn't understand what you meant.

Anyway, it builds fine under VS2008 Express. (roll)
So that means it's VS2010 that has become stricter (assuming it hasn't become more stupid in its conflict resolution).
     

Snarky

  • Local Moderator
  • Mittens Baronet
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: Conflict between the "GUI" namespace and the "GUI" type
« Reply #3 on: 03 May 2012, 17:47 »
It usually depends on the import using (sorry, was thinking Java) statements at the top of the file. If you import the whole namespace it can cause a conflict, while if you import just the classes you need, it'll resolve fine. Highly automated insertion of import using statements is available in VS, so is it possible that you've changed the file in some subtle way?
« Last Edit: 05 May 2012, 16:27 by Snarky »

Calin Leafshade

  • AGS Project Admins
  • Long live King Cat!
    • I can help with AGS tutoring
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
Re: Conflict between the "GUI" namespace and the "GUI" type
« Reply #4 on: 04 May 2012, 09:08 »
I believe conflict resolution in C# is not always explicit. Sometime conflicts will be resolved based upon constructor parameters so it depends how you are instantiating the objects.

However, in 99% of cases its simply due to the using statements at the top (not 'import', what is this ? python?).

Also, since conflict resolution is done by the compiler, not the ide (even by intellisense) it shouldnt matter which ide you use, only which compiler, which is dependant on the version of .NET you are targeting, which should be 2.0 for the AGS editor.

Leon: You need the sword first before you can get the monkey.

Monsieur OUXX

  • Mittens Serf
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: Conflict between the "GUI" namespace and the "GUI" type
« Reply #5 on: 04 May 2012, 16:54 »
Also, since conflict resolution is done by the compiler, not the ide (even by intellisense) it shouldnt matter which ide you use, only which compiler, which is dependant on the version of .NET you are targeting, which should be 2.0 for the AGS editor.

Yes, but imagine the following scenario :
- VS 2010 (and compiler)  introduces new warning levels or conflict resolution rules
- Those rules didn't exist in Vs 2008
- When I import the AGS solution in VS 2010, it sets those new rules to "enabled" by default
- Hence the code that was correctly compiling in 2008 doesn't compile anymore in 2010.

I imagine this scenario because I almost certain that the conflict existed immediately after import, even before I introduced any custom code.