MvvmCross icon indicating copy to clipboard operation
MvvmCross copied to clipboard

<nullable> cause MvxWpfView error

Open tuke307 opened this issue 3 years ago • 1 comments

🐛 Bug Report

Error CS0263 Partial declarations of 'SomeView' must not specify different base classes

Expected behavior

the nullable attribute shouldn't affect the MvxWpfView

Reproduction steps

create a mvvmcross wpf project and add the nullable attribut in project settings

<Project  Sdk="Microsoft.NET.Sdk.WindowsDesktop>
 ....
<PropertyGroup>  
<Nullable>enable</Nullable>  
</PropertyGroup>  
<Project>  

create a view:

<views:MvxWpfView  
x:Class="BlaBla.SomeView"  
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"  
x:TypeArguments="SomeViewModel">  
<Grid>  
...  
</Grid>  
</views:MvxWpfView>  

with a basic code behind:

 public partial class SomeView : MvxWpfView<SomeViewModel>
    {
        public SomeView ()
        {
            InitializeComponent();
        }
    }

Configuration

Version: 8.0.1

Platform:

  • [ ] :iphone: iOS
  • [ ] :robot: Android
  • [x] :checkered_flag: WPF
  • [ ] :earth_americas: UWP
  • [ ] :apple: MacOS
  • [ ] :tv: tvOS
  • [ ] :monkey: Xamarin.Forms

tuke307 avatar Jun 23 '21 13:06 tuke307

You don't have to specify the base class in all partial class definitions (one is enough). Hence the error will go away if if you remove : MvxWpfView<SomeViewModel> from the .cs file but the class will properly inherit from MvxWpfView<SomeViewModel> since the base class is define in the XAML.

eriove avatar Sep 07 '21 10:09 eriove