views:

143

answers:

3

I have a WPF project. When I add a class and a method, and write "this.", I get no intellisense. There is a message in the bottom tab of Visual Studio that an identifier is expected, but that doesn't make sense.

Furthermore, I can't access some methods/objects. Take the following example:

        DbProviderFactory factory =      DbProviderFactories.GetFactory("System.Data.OleDb");

When I try to access the variable, no intellisense comes up (get the same message about an identifier).

Does anyone know why this? To make things worse, I have this problem too: http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/701934bc-5237-40df-aa54-f768debf4e59

Thanks

A: 

Have you tried to restart Visual Studio, I have seen issues with its intellisense like that. If you just go ahead and use the instance, does it compile, if so probably just have to restart the application.

Using "this" if the class is static, the this identifier will not work.

I just typed your exact code in my instance of VS2008 and I got intellisense.

CSharpAtl
When I try to build:C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.WinFX.targets(298,16): error MSB4064: The "SplashScreen" parameter is not supported by the "MarkupCompilePass1" task. Verify the parameter exists on the task, and it is a settable public instance property.C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.WinFX.targets(294,9): error MSB4063: The "MarkupCompilePass1" task could not be initialized with its input parameters.
dotnetdev
I am not familiar with that error....sorry
CSharpAtl
A: 

Is your class or method static? If so, you won't be able to call any instance members or properties using the "this" keyword. If you want to use members or properties in static methods, they have to be static too.

Carlo
Nope, instance based.
dotnetdev
A: 

In my experience Intellisense fails often when the code for the class that you are writing does not compile. So, the cause might be a syntax error in a different line of code or an absent project reference, or using statement.

I cannot help you with the error link you gave. As this sure means that WPF form does not compile, it follows that Intellisense does not work.

Dabblernl
That is exactly what I thought but it doesn't make sense, as this is before I have written any code. So any invalid syntax has to be somewhere written by the designer(s).
dotnetdev
OK, so VS must be broken. Searching for the error "Exception has been thrown by the target of an invocation", should lead you to similar problems an hopefully a solution.
Dabblernl