locked
VS2010 - "System" vs "sysdiagram"

    Question

  • Hi

    In VS2008 I'm used to typing "sys" + tab to let intellisense suggest "System" for me.

    In VS2010 however doing the same makes it suggest "sysdiagram" instead. I have to either type "syst" or press arrow-down do get "System". Is there any way to change this?

    Monday, August 30, 2010 11:12 AM

Answers

  • Given the image you are editing the codebehind of a WinForms app.  The (public) sysdiagram class is coming from code either you've written or auto-generated by the IDE because it resides in the project's namespace.  The only time I've heard of this is with SQL databases.  Nevertheless IS looks for any fields (and then types) in the current namespace first.  Since sys matches a public class in the current namespace it picks it first.

    Michael Taylor - 8/30/2010
    http://msmvps.com/blogs/p3net

    Monday, August 30, 2010 2:21 PM
    Moderator
  • Hi,

    It suddenly crossed my mind. You are probably using EF or Linq to SQL and have classes created for database tables. One of those tables in a SQL Server database is the sysdiagrams table. It stores information about Diagrams you may have produced in your database through the SQL Server Managament Studio. Just remove the table from your imported tables list and from your model and you will no longer have the sysdiagram suggestion in your intellisense.

    Hope this helps.
    Meile Zetstra

    Tuesday, August 31, 2010 7:22 AM

All replies

  • In a normal C# file you won't every get sysdiagram.  System is the only one in scope because, by default, the using statement is added to the top of the file.  Can you be more specific about how you're seeing this behavior because I can't replicate it?

    Also note that in VS 2010 the IS rules have been changed.  When you type a lowercase letter IS assumes that you're looking for a non-type value so it prefers non-type values but when you use an uppercase letter it assumes a type and gives them preference.  This behavior can be seen by typing a lower case 'C' and then trying an uppercase one.

    Michael Taylor - 8/30/2010
    http://msmvps.com/blogs/p3net

    Monday, August 30, 2010 1:27 PM
    Moderator
  • I removed all "using namespace" except System.LINQ.

    Intellisense still suggests "sysdiagram" as shown in this screenie: http://imgur.com/Bjk0D.png

     

    Monday, August 30, 2010 1:59 PM
  • Hi,

    Judging from your screenie, I would say you have your own class sysdiagram in the VS2010WinTest namespace. So when you rename that class, you are in the clear again. You would have the same issue in VS2008, by the way, if you were to use the same code there as well. but with a namespace that includes VS2010 in the name, I would think you have yourself a VS2010 project.

    But to see where the class is located, just  create a new reference to the class like so:

    sysdiagram sd = null;
    

    And then put the cursor on the word sysdiagram, hit F12 and you will jump to the code that declarese the sysdiagram class. If it is not in your source code, it will create a source file from MetaData, with all methods and property signatures.

    Hope this helps
    Meile Zetstra


    http://blogger.xs4all.nl/mzetstra

    Monday, August 30, 2010 2:19 PM
  • Given the image you are editing the codebehind of a WinForms app.  The (public) sysdiagram class is coming from code either you've written or auto-generated by the IDE because it resides in the project's namespace.  The only time I've heard of this is with SQL databases.  Nevertheless IS looks for any fields (and then types) in the current namespace first.  Since sys matches a public class in the current namespace it picks it first.

    Michael Taylor - 8/30/2010
    http://msmvps.com/blogs/p3net

    Monday, August 30, 2010 2:21 PM
    Moderator
  • Hi,

    It suddenly crossed my mind. You are probably using EF or Linq to SQL and have classes created for database tables. One of those tables in a SQL Server database is the sysdiagrams table. It stores information about Diagrams you may have produced in your database through the SQL Server Managament Studio. Just remove the table from your imported tables list and from your model and you will no longer have the sysdiagram suggestion in your intellisense.

    Hope this helps.
    Meile Zetstra

    Tuesday, August 31, 2010 7:22 AM
  • I was testing a few features in VS2010, including LINQ/EF. That sounds like a  reasonable explanation. Thanks.
    Tuesday, August 31, 2010 10:59 AM