Type name does not match file name?

3 posts, 0 answers
  1. David
    David avatar
    90 posts
    Member since:
    Jan 2011

    Posted 07 Feb 2012 Link to this post

    I am enjoying the naming standards enforcement.  While annoying, I am not against standards. Anything to help me is always appreciated.  I am running into a apparent glitch which I cannot explain.  In a c# file entitled "Change.cs", I get the error "C#: Type name does not match file name".

    The class is defined with the following snippet....

    namespace StormDataLayer
    {
        [Serializable]
        [XmlType(Namespace = "urn:Change")]
        [XmlRoot(Namespace = "urn:Change")]
        public class Change : IComparer<Change>
        {
               // more code
    
        }
    }


    Given that the file name is in fact the same name as the class name, why am I getting the error?  Originally the file name was "CHANGE.cs".  I renamed it to match the case of the class without any effect on the error.

  2. Ivan
    Admin
    Ivan avatar
    106 posts

    Posted 07 Feb 2012 Link to this post

    Hello,

    Thank you for your feedback. I was able to reproduce this behaviour, but the warning disappeared when I refreshed the code analysis after renaming the file to match the type name.
    Could you confirm that this solves your issue, too? To refresh the analysis select "JustCode -> Analysis -> Refresh Code Analysis".
    If this does not solve it, it would be highly appreciated if you could send us a sample solution that reproduces this issue.
    Your help is highly appreciated!

    Kind regards,
    Ivan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. David
    David avatar
    90 posts
    Member since:
    Jan 2011

    Posted 07 Feb 2012 Link to this post

    Your solution worked.  I guess I really need to read the owners guide on Just Code to learn all of its features.  I was unaware of the "refresh code analysis" option.  It makes perfect sense in hindsight now.

    Thank you for your assistance (and great products)
Back to Top