Reputation: 4847
I have a class named Strings
which has some const strings. I am referencing these consts from another class named TestScript1
.
Both Strings
and TestScript1
are in the same project.
Intellisense is reporting an error when I access the consts from Strings
in TestScript1
as shown in the following image:
However, if I compile and run the project, everything works fine - no compile errors, no runtime exceptions. Furthermore, if I change the error window to show "Build Only" errors, no errors appear on build, but I still see the squiggly red underlines.
Things I've tried:
Is there anything I can do to get Visual Studio's intellisense to realize that this is not in fact a compile error?
Update 1: Here's some more details and things I've tried.
The Storyvania.DataTypes
namespace contains 5 other classes. Those all show up just fine in intellisense, it's just the Strings class.
I am using Visual Studio Community 2017, Version 15.4.1.
The problem I'm experiencing is not only a syntax error but the dropdown that appears when typing does not recognize the Strings
class.
I've also tried (to no avail):
const
strings to static
Strings
class to itself being static
Strings
class public
(it shouldn't matter because they're in the same project, but I tried it anyway)Storyvania.DataTypes.Strings
rather than just Strings
with a using
statement.Upvotes: 2
Views: 2235
Reputation: 1235
VS 2019 also has the problem. It seems that VS fails to clear/update some of the data they cache. Try deleting folders named .vs
from root of your repository/solution and its subfolders.
Upvotes: 5