-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix EventCallback Net8.0 #150
Fix EventCallback Net8.0 #150
Conversation
I'll take a closer look. It's one thing that it performs unnessessary renders (like mentioned in the original issue). But even with that it shouldn't fall into infinite loop. What issues did you have with the exact version VS "$(MauiVersion) ? |
The project template (as the other maui templates) specify a |
I think it is fine to leave it as exact version. |
Regarding EventCallbacks changes. I suggest to add two methods to protected static bool Equals(EventCallback e1, object e2) { ... };
protected static bool Equals<T>(EventCallback<T> e1, object e2) { ... }; This way no generator changes are needed, and it will be easier to remove them later. Regarding equality check itself. Let's remove all that expression and reflection stuff, and use |
Ok I'll revert the changes when possible |
I've never used this attribute I'll inform myself on that and replace with what you suggested |
324a3b9
to
2208bf1
Compare
Could you provide a repro project, illustrating the issue? For future cases, please create an issue before submitting a PR with a fix. It is easier to discuss an issue itself separatelt from implementation details. |
Yes sorry. Thought that this was a quick fix. Let's do this, let's close this, I'll open an issue with the repo to try the issue and then create a PR when I'll manage to implement the UnsafeAccessor. Sounds good? |
You can leave it open, up to you. As for UnsafeAccessor - I think you need to use the exact type for the method parameter, not just object. |
Yes was just modifying that, only exception is giving me is some kind of "Bad Format" I'll try fix it later |
Unfortunately generic parameters are not supported yet, only .NET 9. See this issue |
I see, that's unfortunate. |
Thanks a lot for your contribution! |
During testing of the library, I discovered that
EventCallbacks
in.NET 8
are not invoking theEquals
method correctly, which is documented in this issue. For instance, setting theOnLoaded
EventCallback
triggers an infinite loop as it continually sets and unsets the callback. This behavior also occurs with other callbacks, such asOnClick
.To work around this issue, I implemented a utility class to compare
EventCallback
instances. While this is a temporary solution, it appears necessary as the two properties required to check equality are internal, and the fix has been moved to.NET 10
as noted in the issue.