Title: Porting Parse SDK and Live Queries to .NET 9 and MAUI: My Journey and Contributions
Hello Parse Community,
I hope this message finds everyone well. I wanted to share my journey of porting the Parse SDK and Live Queries to .NET 9 and .NET MAUI. This endeavor has been both challenging and rewarding, and I believe it can greatly benefit our community.
A Personal Quest for a Solution
I was going through a tough time, needing the most minimal and efficient solution to build a finance management app with a real-time communication feature—a niche idea where an “expense” can have a comment section for real-time chatting. I chose .NET MAUI for its cross-platform capabilities.
Unfortunately, MongoDB had discontinued Atlas, leaving me in a bind. Fortunately, they recommended Parse, and it turned out to be the perfect solution with minimal stress. I dove into the documentation and was thrilled by how closely it resembled MongoDB and how seamlessly it integrated with C#.
Challenges with .NET MAUI Integration
However, I noticed that not a single doc mentioned .NET MAUI. It felt like MAUI was being overlooked, which puzzled me because it’s a great framework for some of us!
I encountered crashes due to the HostManifestData
property, especially on Windows, Android, and macOS (I haven’t tested on iOS yet). By manually setting a new HostManifestData
in code, I fixed the issue, and Parse started working flawlessly with Back4App on the server side—a fantastic plug-and-play experience!
The Need for Live Queries
After speaking with the Co-Founder and Lead Architect at Back4App, they suggested using Live Queries. However, there was little guidance on how to implement them in .NET, especially with .NET MAUI. The official Parse docs only covered Xamarin, and Live Queries were exactly what I needed.
I found a six-year-old port of Live Queries for .NET 2, but it lacked documentation—not even a “How to start.” Undeterred, I decided to port everything to .NET 9, updating old methods, replacing the outdated WebSocket client with System.Net.WebSockets.Client
, and ensuring it built correctly.
Overcoming Technical Hurdles
This process involved hours of debugging, compiling, and understanding the flow. I was familiar with async coding in .NET 7 onwards but had to revisit concepts from .NET 2. After updating everything, I finally grasped how to use Live Queries, which were heavily dependent on the Parse SDK for .NET.
Using the latest official SDK resulted in crashes, so I decided to update it as well. My task was simple: translate everything to .NET 9 and test it. This led to more hours of debugging and resolving hundreds of errors due to old API references and warnings. I began to question if I had underestimated the endeavor, but I was already deeply invested, and it was important.
Contributions and Improvements
I focused on the following enhancements:
-
Upgraded to .NET 9 and MAUI: Ensured the Parse SDK and Live Queries work seamlessly on .NET 9 and .NET MAUI, particularly on Windows, Android, and macOS.
-
Modernized Async Methods: Replaced outdated async patterns like
.Unwrap()
and.OnSuccess()
with the new async/await methods for better performance and readability. -
Updated WebSocket Implementation: Switched to
System.Net.WebSockets.Client
, providing a more stable and efficient connection for Live Queries without adding extra dependencies. -
Error Handling Improvements: Implemented a new way to receive Parse errors as documents instead of throwing exceptions, which was a significant pain point for me.
-
Decoupled SDK and Live Queries: Kept the Parse SDK and Live Queries Separated to give developers the choice to use either or both, promoting flexibility.
-
Merged Validated PRs: Included fixes for crashes and merged all validated PRs from the .NET SDK repository (GitHub PRs).
-
Minimal Dependencies: Kept the projects as plain as possible, adding feature parity without introducing unnecessary dependencies.
My Approach and Philosophy
While I didn’t follow the Parse .NET SDK strictly to the dot, I believe some of the documented recommendations were mainly valid for their version’s scope. I tried to adhere closely to their control flow, ensuring every method call is done in the same order as in the official repo.
When it comes to testing, I prioritize security over stability. I’d prefer to receive feedback about my solution crashing over it leaking critical information any day. I understand this might not align perfectly with the community’s priorities, but I believe it’s a responsible approach.
Links
I am NOT very savvy when it comes to using markdown for beautiful readmes but I at least showed some steps!
My Parse Port on GitHub
My LIVE QUERIES for Parse Port on GitHub
A Sample Chat APP for .NET MAUI on Windows and Android (It has a YouTube Link on how implement LQ on MAUI Too!)
Why I’m Sharing This
Despite the port being 100% mergeable, I chose not to submit a PR immediately. I anticipate it would generate many questions and test requests, which are entirely valid. However, I wanted to start by sharing my journey, offering my contributions, and seeing if there’s interest in integrating these changes.
I believe making Live Queries available in any app with less than 50 lines of code can be a huge motivation for many developers to give Parse a try. I’m open to explaining every single line I changed, everything I added or removed, and why—no worries on that!
Acknowledgments
I want to express my deepest gratitude to:
-
The Parse Team: Thank you for your continuous help—you helped me put something on the table, and I’m only trying to give back.
-
The Amazing Team at Parse for .NET: The SDK is huge and has some extremely commendable technicalities—it brought me tears of joy to see how we manually dance with mutexes, functions, and orchestrate async operations. I can’t express my deepest respect enough!
-
JonMcPherson: Thanks for the huge first step with Live Queries. I just wonder if you started this to play Minecraft? I see the potential! Haha!
-
Back4App: For being down-to-earth and listening to my nerdy rants. Great platform—fast and reliable!
A Little More About My Journey
I was in a difficult financial situation and needed to create something meaningful. Parse provided me with an elegant and minimal solution for a project that was very important to me. Working on porting the SDK and Live Queries not only helped me professionally but also personally, as it reignited my passion for coding.
Final Thoughts
I strive to be ask skilled and am very heady at time, and I humbly acknowledge that. I needed a solution, and Parse helped a lot. Now I want to help back. I know my approach wasn’t the standard way, but I thought suggesting considering it since there has been a long demand, and I’m open to helping even more.
I’m excited about the possibilities this brings to the Parse community and am eager to collaborate with anyone interested. Let’s make Parse even better together!
Happy coding, my friends.
Yvan Brunel