✅ 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
No description
17 Replies
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
This is my MainWindow.xaml file
No description
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
As you can see debugging works
No description
blueberriesiftheywerecats
Can you navigate into that method?
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
I can't, VSCode doesn't recognize it as a existing method
blueberriesiftheywerecats
Did you make this project from scratch or via cli wpf template?
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
CLI template dotnet new wpf -lang "C#" -n wirefetch
blueberriesiftheywerecats
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
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
It does, and it works, but for some reason intellisense doesn't like InitializeComponent()
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
These are all the files
No description
blueberriesiftheywerecats
Try this.InitializeComponent()
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
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?)
blueberriesiftheywerecats
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 ...
blueberriesiftheywerecats
You can try solution at the very end of discussion
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
Oh yes! this works, thx ❤️
BAJAJ Rouser RS200
BAJAJ Rouser RS200OP2mo ago
Is there any way to mark that as a solution? Answer Overflow gives me this
No description
MODiX
MODiX2mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server