Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile under linux_x86_64 with dynamic type in ObservableProperty #876

Open
1 of 4 tasks
jindongjie opened this issue May 13, 2024 · 2 comments
Open
1 of 4 tasks
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior

Comments

@jindongjie
Copy link

Describe the bug

I'm trying to compile a C# Avalonia crossplatform project on Linux that uses the MVVM Community Toolkit. The project compiles and runs fine on Windows, but on Linux I'm getting a compilation error with the following line of code:

[ObservableProperty]
private dynamic _selectedDevice = null!;

The program compiles without errors on Windows, even when I target Linux as the runtime. However, when I transfer the compiled program to a Linux machine and try to run it, it fails with the following error:

/home/admin/Desktop/code/BTS/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator/WD_BTS.ViewModels.MainWindowViewModel.g.cs(63,46): error CS8716: There is no target type for the default literal.
/home/admin/Desktop/code/BTS/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator/WD_BTS.ViewModels.MainWindowViewModel.g.cs(67,45): error CS8716: There is no target type for the default literal.

Regression

8.2.2

Steps to reproduce

1. Make sure you are in a Linux environment.
2. Create a new cross-platform project using Avalonia. Make sure to select the Community Toolkit for MVVM during the setup.
3. Create a new View and ViewModel.
4. In the ViewModel, try to write the following code: 
[ObservableProperty]
private dynamic _selectedDevice = null!

Expected behavior

Code work fine :)

Screenshots

No response

IDE and version

Rider

IDE version

No response

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.2.2

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

@jindongjie jindongjie added the bug 🐛 An unexpected issue that highlights incorrect behavior label May 13, 2024
@shahine44
Copy link

How often can I not open the Microsoft Store, it opens but does not bring the applications

@jindongjie
Copy link
Author

How often can I not open the Microsoft Store, it opens but does not bring the applications我多久可以不打开 Microsoft 商店,它会打开但不带来应用程序

I have no-idea what's your talking about :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

No branches or pull requests

2 participants