Visual Studio 2022 Community Edition ^new^ ❲No Survey❳
There it was. A fat, orange rectangle. Not in her ReceiptService.cs . Not in the database call. It was inside System.Drawing.Common , resizing the charity's logo. A simple using (var ms = new MemoryStream()) that was, under the hood, calling a GDI+ API that had to marshal data across to a native Windows library. Every. Single. Time.
She hit Ctrl+Q and typed "Performance Profiler". The familiar panel dropped down. CPU Usage. Async. Database. She checked "Instrumentation" and clicked the green arrow. visual studio 2022 community edition
The problem was the receipt generator. It worked, technically. But for donations over $10,000, the PDF generation would lag for a full seven seconds. In the test environment, it was an annoyance. In the live gala next week, with dozens of high-rollers clicking "donate" on their phones, seven seconds might as well be seven years. There it was
She refactored it in a flash. Cached the resized logo as a static byte array on first load. No more marshaling. No more per-receipt processing. Not in the database call