🧠My Weekly Learnings: Async/Await Pitfalls, LINQ Magic & Azure Deployment Tips
Published on: June 1, 2025
Category: Reflection, .NET Development
Tags: #DotNet #AsyncAwait #Azure #DeveloperThoughts #WeeklyReview
🚀 1. Diving Deeper into async/await
This week, I revisited some old code and noticed how easily async void
can sneak in and wreak havoc—especially in event handlers. A few lessons reaffirmed:
- Avoid
async void
unless you're in UI event handlers. - Always return
Task
orTask<T>
to preserve exception handling. - Watch for deadlocks in synchronous contexts (e.g.,
.Result
or.Wait()
).
Mini Tip: Use ConfigureAwait(false)
wisely to avoid capturing the synchronization context when it's not needed (like in ASP.NET Core).
🔄 2. LINQ – A Small Change, Big Impact
I explored GroupBy().Select()
combinations and discovered how leveraging .ToLookup()
can clean up conditional joins with better readability. Also, performance is surprisingly better in large collections.
var lookup = dataList.ToLookup(x => x.Category);
This helped refactor a reporting module in one of my side projects.
☁️ 3. Azure Web App Deployment: A Win & A Warning
While deploying a .NET 8 web app to Azure App Services, I:
- Switched from FTP to GitHub Actions – smoother and automated.
- Faced a config issue where
appsettings.Production.json
wasn't picked up.
Fix: Explicitly set ASPNETCORE_ENVIRONMENT
in the Azure Configuration blade.
Also checked out Azure Monitor — great insights with minimal setup!
💡 Closing Thought
Every week presents an opportunity to revisit fundamentals. I’m learning that great code isn’t just about syntax, but understanding why certain practices matter. Looking forward to diving into Blazor next week!
👉 Over to you!
What did you learn this week as a .NET developer? Share in the comments with your insights!