Most code files belong to a project, which can be C#, VB.NET, etc. and all the files of the project must be in the same language. VS 2005 introduced Web Site projects which allow to mix code files in different languages. In both cases, when you request the code model from the code file using ProjectItem.FileCodeModel, you get something.
A couple of days ago I became aware of a third “kind” of code file: introduced by VS 2005, you can right-click the solution node in the Solution Explorer, click Add, Add New Item… and select “Visual C# Class” or “Visual Basic Class”. I don’t know why one would want to add code files to the Solution Items node of the Solution since they won’t be compiled, but you can. The interesting thing from the automation model (EnvDTE) point of view is that the ProjectItem.FileCodeModel returns Nothing (null in C#). So, chances are that the features of your add-in that deal with code files will fail against this kind of code files.