This is a migrated thread and some comments may be shown as answers.

Type name does not match file name?

3 Answers 511 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
Iron
Veteran
Iron
David asked on 07 Feb 2012, 04:22 PM
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.

3 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 07 Feb 2012, 04:41 PM
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 >>
0
David
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 07 Feb 2012, 04:45 PM
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)
0
Randall
Top achievements
Rank 2
answered on 29 Mar 2017, 06:00 PM

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.

Thanks,

Randall Price

Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Ivan
Telerik team
David
Top achievements
Rank 1
Iron
Veteran
Iron
Randall
Top achievements
Rank 2
Share this question
or