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

System.Collections.Specialized.ReadOnlyList not supported by AOT generator #1727

Open
FrayxRulez opened this issue Aug 27, 2024 · 3 comments
Labels
AOT bug Something isn't working

Comments

@FrayxRulez
Copy link

Describe the bug
System.Collections.Specialized.ReadOnlyList fails to cast to IList and it makes it impossible to raise INotifyCollectionChanged.CollectionChanged event from user code.

Version Info
2.1.1

Additional context
Sorry for opening a lot of tickets, I believe that a lot of this stuff is already being tracked internally, but you never know...

@FrayxRulez FrayxRulez added the bug Something isn't working label Aug 27, 2024
@manodasanW
Copy link
Member

No worries on the number of issues being opened. It looks like ReadOnlyList is an internal type within the .NET runtime used for CollectionChanged scenarios. Our AOT source generator isn't able to detect those and make them AOT safe. We have plans on having a fallback mechanism that uses the statically known type which is tracked by #1661.

In the meantime, you might be able to workaround that issue by following the guidance here: https://github.com/microsoft/CsWinRT/blob/master/docs/aot-trimming.md#known-issues-when-publishing-for-aot

@Gaoyifei1011
Copy link
Contributor

Describe the bug System.Collections.Specialized.ReadOnlyList fails to cast to IList and it makes it impossible to raise INotifyCollectionChanged.CollectionChanged event from user code.

Version Info 2.1.1

Additional context Sorry for opening a lot of tickets, I believe that a lot of this stuff is already being tracked internally, but you never know...

Isn't readonlylist in the system.collections.generic namespace?

@FrayxRulez
Copy link
Author

you might be able to workaround that issue by following the guidance here

Yep, managed to workaround the other issues as well.

Isn't readonlylist in the system.collections.generic namespace?

This seems to be a different implementation used only internally 😅

@manodasanW manodasanW added the AOT label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AOT bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants