✅ Weird VSCode & WPF bug with C# Dev Kit
Im trying to make a WPF app in VSCode (im trying to make it without XAML though i didn't remove any of the XAML files) and this error keeps appearing in my VSCode
This problem is not present when i debug or build the project, it is only an intellisense problem
Using C# Dev kit & C# extension
17 Replies
This is my
MainWindow.xaml
fileAs you can see debugging works
Can you navigate into that method?
I can't, VSCode doesn't recognize it as a existing method
Did you make this project from scratch or via cli wpf template?
CLI template
dotnet new wpf -lang "C#" -n wirefetch
Im not rly a desktop dev but as far as I know every xaml file has its own cs file with interface controls and properties defined in Init method, that's where you get that method from
It does, and it works, but for some reason intellisense doesn't like
InitializeComponent()
These are all the files
Try this.InitializeComponent()
Doesn't work, i already tried it
Error when using
this.InitializeComponent()
is 'MainWindow' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'MainWindow' could be found (are you missing a using directive or an assembly reference?)
GitHub
[WPF] VSCode shows error for WPF project: "The name 'InitializeComp...
1/ Install .NET Core 7.0 2/ Create WPF project with "dotnet new wpf" 3/ VSCode > Open Folder. After awhile, VSCode shows many errors: "The name 'InitializeComponent' does ...
You can try solution at the very end of discussion
Oh yes! this works, thx ❤️
Is there any way to mark that as a solution? Answer Overflow gives me this
$close
If you have no further questions, please use /close to mark the forum thread as answered