preview7 Duplicate InitializeComponent generated
See original GitHub issueDescribe the bug preview7 generates duplicate InitializeComponents edit: this happens in preview6 too
To Reproduce Steps to reproduce the behavior:
cd ~\Desktop
mkdir issue_11143
cd issue_11143
dotnet new avalonia.xplat
# Upgrade to preview7
(Get-Content .\Directory.Build.props).replace('preview5', 'preview7') | Set-Content .\Directory.Build.props
dotnet build
Result:
C:\Users\doug\Desktop\issue_11143\issue_11143\ViewLocator.cs(10,20): warning CS8767: Nullability of reference types in type of parameter 'data' of 'Control
ViewLocator.Build(object data)' doesn't match implicitly implemented member 'Control? ITemplate<object?, Control?>.Build(object? param)' (possibly because o
f nullability attributes). [C:\Users\doug\Desktop\issue_11143\issue_11143\issue_11143.csproj]
C:\Users\doug\Desktop\issue_11143\issue_11143\Avalonia.NameGenerator\Avalonia.NameGenerator.AvaloniaNameSourceGenerator\issue_11143.Views.MainWindow.g.cs(19
,21): error CS0111: Type 'MainWindow' already defines a member called 'InitializeComponent' with the same parameter types [C:\Users\doug\Desktop\issue_11143
\issue_11143\issue_11143.csproj]
C:\Users\doug\Desktop\issue_11143\issue_11143\Avalonia.NameGenerator\Avalonia.NameGenerator.AvaloniaNameSourceGenerator\issue_11143.Views.MainView.g.cs(18,2
1): error CS0111: Type 'MainView' already defines a member called 'InitializeComponent' with the same parameter types [C:\Users\doug\Desktop\issue_11143\iss
ue_11143\issue_11143.csproj]
Build FAILED.
C:\Users\doug\Desktop\issue_11143\issue_11143\ViewLocator.cs(10,20): warning CS8767: Nullability of reference types in type of parameter 'data' of 'Control
ViewLocator.Build(object data)' doesn't match implicitly implemented member 'Control? ITemplate<object?, Control?>.Build(object? param)' (possibly because o
f nullability attributes). [C:\Users\doug\Desktop\issue_11143\issue_11143\issue_11143.csproj]
C:\Users\doug\Desktop\issue_11143\issue_11143\Avalonia.NameGenerator\Avalonia.NameGenerator.AvaloniaNameSourceGenerator\issue_11143.Views.MainWindow.g.cs(19
,21): error CS0111: Type 'MainWindow' already defines a member called 'InitializeComponent' with the same parameter types [C:\Users\doug\Desktop\issue_11143
\issue_11143\issue_11143.csproj]
C:\Users\doug\Desktop\issue_11143\issue_11143\Avalonia.NameGenerator\Avalonia.NameGenerator.AvaloniaNameSourceGenerator\issue_11143.Views.MainView.g.cs(18,2
1): error CS0111: Type 'MainView' already defines a member called 'InitializeComponent' with the same parameter types [C:\Users\doug\Desktop\issue_11143\iss
ue_11143\issue_11143.csproj]
1 Warning(s)
2 Error(s)
Expected behavior A clean build.
Screenshots
Desktop (please complete the following information):
- OS:
- Windows 10 Pro x64 Version 10.0.19044 Build 19044
- Version [e.g. 0.10.0-rc1 or 0.9.12]
- 11.0.0-preview7
Issue Analytics
- State:
- Created 5 months ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Duplicate Model instantiated from InitializeComponent()
I have a model class DeviceModel instantiated from App.xaml.cs. This model implements INotifyPropertyChanged interface. ... This works great! I ...
Read more >Updated Modern Code Generation for WinForm's ...
When you design a WinForms Form, it gets generated into a method called InitializeComponent. When you reopen that Form, it gets recreated by ......
Read more >Every InitializeComponent() reference in my project is ...
Every InitializeComponent() reference in my project is throwing an exception, I'm stumped. Any ideas? · Try a Clean All, then a rebuild. ·...
Read more >11.0.0 Preview 7 · AvaloniaUI Avalonia · Discussion #11117
This discussion was created from the release 11.0.0 Preview 7. ... CS1501: No overload for method 'InitializeComponent' takes 2 arguments.
Read more >Visual Studio 17.2.6 Breaks CommunityToolkit.Mvvm #6792
It's odd that msbuild would do that, It feels like the compiler should be modified to give a diagnostic and/or dedupe the duplicate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
also had an issue with the
ViewLocator
which was not listed in Breaking Changes, part of the default Avalonia UI template in Visual Studio.For those who arrive here with the same issue:
it will conflict with build in generator now
in the linked breaking changes refers among other things to duplicate generation ofInitializeComponent
.I got my app updated from preview5 to 7. There were a few things broken whose fixes I found digging through pull requests. All expected for a preview version.
Thanks for the support.