WPF - InitializeComponent cannot be found

Hi,

 

after trying out Avalonia and returning to WPF, the editor is telling me that "InitializeComponent" within my UserControls is not defined.

Example

 

Code Behind

 

XAML

 

Edit: Got it, just had to remove all Avalonia nuget references...

5 comments
Comment actions Permalink

Hi Tabaloa,

I know the topic is a bit old, but I'm actually running into exactly the same problem. Rider complains the "InitializeComponent" in all Windows and UserControl. Beside that it is building and running the application. 

What do you mean by removing all avalonia nuget references? If I remove all of them, I can no longer create the project, of course.

0
Comment actions Permalink

Hello Wenndermann,

Thank you for contacting Rider support.

I was not able to reproduce this issue with the actual version of Rider 2022.2.3 (Win10). If you are not on the actual version, I suggest updating Rider as it might help to resolve the issue. As a possible solution, I suggest checking the MSBuild set in `File | Settings | Build, Execution, Deployment | Toolset and Build | MSBuild version`. Please, try seting the one from Visual Studio folder if you have such.

If it doesn't help, would you mind sharing the additional information as described below?

  • Rider logs (`Help | Collect Logs`) collected shortly after you reproduced the issue;
  • What is the Avalonia project template you use?

Thank you in advance and have a nice day!

0
Comment actions Permalink

Hello everyone,

Unfortunately I'm experiencing the same issue on Rider 2022.2.3 (Ubuntu 22). The project builds fine, but the editor does not detect the auto-generated `InitializeComponent` method. The project template and logs do not matter, it's simply the case of Rider not detecting auto-generated classes.

1
Comment actions Permalink

Thanks for your replay.

After fiddling around with it for some time I recognized that rolzlyn analyzers had been turned of on my machine. Enabling it solved the problem for me. 

 

0
Comment actions Permalink

Hello Wenndemann,

I am glad to hear that the solution was found.

Hello SlidyDev,

Would you mind checking if you have the option Wenderman mentioned enabled?

Have a nice day!

0

Please sign in to leave a comment.