Type name does not match file name?

Thread is closed for posting
4 posts, 0 answers
  1. David
    David avatar
    109 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
        [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
    Ivan avatar
    106 posts

    Posted 07 Feb 2012 Link to this post


    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,
    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. David
    David avatar
    109 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)
  4. Randall
    Randall avatar
    55 posts
    Member since:
    Jun 2008

    Posted 29 Mar 2017 Link to this post

    I just encountered the same problem with "Type name does not match the file name."  I tried refreshing the JustCode analysis but that did not remove the error.  I tried it again but still did not remove the error.

    I fixed it by excluding the file from the project and including it back.  The JustCode warning is cleared now.


    Randall Price

Back to Top