khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

👋 folks, when was the last time you used an event handler in your codebase?

Think “timer.Interval+= DoStuff”.

ThibaultDu,
@ThibaultDu@mastodon.social avatar

@khalidabuhakmeh A few hours ago, MAUI UI event handlers and MVVM PropertyChanged-events.

dr_cox1911,

@khalidabuhakmeh Daily at work. We use this still quite expensively with Blazor states and our source generated SignalR hub.

Anything that's bad about this?

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@dr_cox1911 no, not necessarily. They are common sources of memory leaks but that's it.

Cowthulu,
@Cowthulu@mastodon.social avatar

@khalidabuhakmeh all the time in WinForms and WPF code, but generally avoid events for non-UI stuff for coupling/lifetime issues.

b4ux1t3,
@b4ux1t3@hachyderm.io avatar

@khalidabuhakmeh I use them in Godot!

But godot automatically sets up the -= in source gen.

Personally, I think the syntax is problematic, but that the functionality is very useful, and I wish it had better memory safety. (which, as godot has proven, is easily solvable with source gen)

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@b4ux1t3 does that mean the Dispose method is auto implemented?

b4ux1t3,
@b4ux1t3@hachyderm.io avatar

@khalidabuhakmeh AFAIK there is a sort of...o don't want to say "custom disposable implementation", but that's the closest way I can think of to describe it.

Let me share some code when I'm at my computer in a bit, I'm having trouble remembered the guts.

b4ux1t3,
@b4ux1t3@hachyderm.io avatar

@khalidabuhakmeh Man, there's a lot to parse through.

Here's where the "User-land" signals get "passed off" to the "Godot-land" C#. The lifetime of the nodes (the objects in the game world) is all managed by the engine internally; I'm not 100% on the specifics (I briefly looked at this several weeks ago now), but, the C# classes which wrap "native" GD primitives get all of that handled by their node classes, and are cleaned up when the node is cleaned up in the "native" code.

b4ux1t3,
@b4ux1t3@hachyderm.io avatar

@khalidabuhakmeh even rider is having trouble stepping back into the engine code:

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@b4ux1t3 please file an issue. I know we're looking at improving Godot support.

jeremyburman,

@khalidabuhakmeh I still use them for cross component events in Blazor. Not going to say that I enjoy using them though.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@jeremyburman do you have a code sample?

sinkinstar,

@khalidabuhakmeh this year

hbons,
@hbons@mastodon.social avatar

@khalidabuhakmeh I really liked this concept as a new C# user as it's so easy to understand. but later once you learn it launches a new thread and you have to manage everything that you attach it becomes hard to maintain...

davidwengier,
@davidwengier@aus.social avatar

@khalidabuhakmeh Haven't written a new one in a while, but there are a few in the codebase I work in, and I see no reason to remove them.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@davidwengier the reason I ask is because it's a common source of memory leaks, but many newer code bases have likely never used them.

damselfly,
@damselfly@fosstodon.org avatar

@khalidabuhakmeh @davidwengier Yeah, seen some really nasty ones where Dispose was declared, to unhook the handler, but because

@implements IDisposable

Wasn't declared on the razor component, they never get called. Asked MSFT to add an analyser (if a dispose method is declared, but the class doesn't implement IDisposable, it should warn). They said no. I think Rider does it though!

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@damselfly @davidwengier funny. I actually was the one to suggest we add that to Rider. 😅

damselfly,
@damselfly@fosstodon.org avatar

@khalidabuhakmeh @davidwengier Nice. I know so many people that have been bitten by it, and there's probably a Plethora of memory leaks in place today because people don't realise.

Here's the issue that MSFT nope'd.... https://github.com/dotnet/aspnetcore/issues/40638

davidwengier,
@davidwengier@aus.social avatar

@damselfly @khalidabuhakmeh Making that same request on dotnet/roslyn or dotnet/roslyn-analyzers might get you further.

damselfly,
@damselfly@fosstodon.org avatar

@davidwengier @khalidabuhakmeh Thanks. Or maybe Javier should have redirected the issue instead of just closing it.... 😉

I don't care any more though because VS for Mac is dead, so the fact that Rider warns me solves the issue. Feel free to raise on my behalf though!

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@damselfly @davidwengier what's Roslyn?

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar
davidwengier,
@davidwengier@aus.social avatar

@khalidabuhakmeh @damselfly It's a small town in Washington state. I've never been, but Northern Exposure was filmed there.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar
Hinnerk,
@Hinnerk@mastodon.social avatar

@khalidabuhakmeh Couple of hours ago: Geolocation.LocationChanged += Geolocation_LocationChanged;

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@Hinnerk Is this Blazor or MAUI?

Hinnerk,
@Hinnerk@mastodon.social avatar

@khalidabuhakmeh MAUI - … the only reason I have not done the switch from VS to Rider on the Mac by now. 🙈🙃

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@Hinnerk We have MAUI support. What’s keeping you from switching?

Hinnerk,
@Hinnerk@mastodon.social avatar

@khalidabuhakmeh Sure, but that support seems to stop at the simulator. I was not able to debug anything on a real physical iOS Device and found only people having the same issues trying with Rider.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@Hinnerk We just released a bug fix with the latest release that should allow you to deploy and debug on remote devices.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@Hinnerk We definitely want the MAUI experience to be better and we have resources planned to do so.

Hinnerk,
@Hinnerk@mastodon.social avatar

@khalidabuhakmeh That sounds amazing. To be fair, I (and probably others too) just started the trial on Rider when VS was announced to become Abandonware on Mac soon. I was a bit disappointed when that did not work out of the box but planned to explore the issue further over the upcoming Holidays. The trial period just resetted with the new Release. 👍

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@Hinnerk contact our sales team. We're not pushy. We'll extend your trial for as long as you need.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • dotnet
  • DreamBathrooms
  • mdbf
  • osvaldo12
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • cubers
  • slotface
  • khanakhh
  • kavyap
  • InstantRegret
  • Durango
  • JUstTest
  • everett
  • ethstaker
  • cisconetworking
  • provamag3
  • Leos
  • modclub
  • ngwrru68w68
  • tacticalgear
  • tester
  • megavids
  • normalnudes
  • anitta
  • lostlight
  • All magazines