Async Event Handlers in C#: What You Need to Know
Learn how to safely use async event handlers in C#. Understand the dangers and discover best practices for managing async event handlers in your C# code.
Learn how to safely use async event handlers in C#. Understand the dangers and discover best practices for managing async event handlers in your C# code.
Are you struggling with memory leaks due to your event handlers and events in C#? Check out how weak events in C# can help with garbage collection in your apps!
Check our these examples of the observer pattern in C#! Learn how the observer pattern in C# can simplify the usage of events in your next project!
If you're writing asynchronous code in C# and using EventHandlers, odds are you've had issues with exceptions. Task EventHandlers might be consideration!
Dealing with async EventHandlers in C# can be very problematic. async void is a pattern cause headaches with exceptions. Check out this simple solution!
Background Thalmic Labs has started shipping their Myo armband that allows the wearer's arm movements and gestures to control different pieces of integrated technology. How cool is that? My friend and I decided we wanted to give one a whirl and see what we could come up with. We're both C# advocates, so we were a bit taken back when we saw the only C# support in the SDK was made for Unity. We decided to take things into our own hands and open source a Myo C# library. We're excited to introduce the first version of MyoSharp! The underlying Myo components are written in C++, and there's only several functions that are exposed from the library that we can access. In order to do this, we need to leverage platform invocation (PInvokes) from C# to tap into this functionality. Once you…
Hack The North... What The Hack Is That? Hack The North is Canada's largest international hackathon. It's big. It's bad. It's awesome. Okay, but what does that even mean? The idea is that 1000 people get together from all over the world in an event where they're given 36 hours to create amazing technology hacks. There's a lack of sleep but no lack of amazing ideas and hacked together proof of concepts that show incredible innovation. Sponsors are present to hand out prizes for best usage of their product or API to competitors as well as mentor them and provide help with problem solving. This year, Hack The North was hosted at The University of Waterloo. Bro, Do You Even Hack?! This was my first time ever at a hackathon. I've participated in the Ontario Engineering Competition (OEC) which is much…
Cameron Sapp and a Little Background A couple weeks ago I mentioned that I wanted to start publicly acknowledging some of my teammates. While this is the first one, it certainly won't be the last. At Magnet Forensics, I'm surrounded by many individuals that bring a lot to the table. There's certainly no reason and no way I'd only be able to pick one person to write about. Now there wasn't a particular reason I picked this individual first, but I think I had some concrete things fresh in my head that I wanted to share. Without too much more rambling, I'd like to introduce Cameron Sapp! New Kid on the Block Cameron joined our team earlier this year. I don't think any of us doubted his technical abilities and we were all excited to bring him on board.…
Background If you've poked through my previous postings, you'll probably notice that I love using events when I program. If I can find a reason to use an event, I probably will. I think they're a great tool that can really help you with designing your architectures, but there are certainly some common problems people run into when they use events. The one I want to address today has to do with memory leaks. That's right. I said it. Memory leaks in your .NET application. Just because it's a managed language doesn't mean your code can't be leaking memory! And now that I've got your attention, let's see how events might be causing some leakage in your application. (There is source that you can download and run. Check the summary section at the end!) Instance-Scope Event Handlers One of the…
An example in C# about how to create a singleton with support for dependency injection or inversion of control (IOC).