Hunting for native stack traces in an app written in C# but uses C++ libs

Forgive us for being a little too geeky with this post but this has been a sticky issue that caused a lot of heartburn with our engineering team lately, so we have decided to share what we found. And to reinforce that old notion, there is light at the end of that coding tunnel after all!

First, a refresher. Our Pulsar for Salesforce mobile offline app has been available on Android and Windows app stores for a few months now. We used Xamarin platform to develop the app, so that it would run natively on both platforms. The language of choice for this environment is C# but we were able to reuse the core pieces of our dev work on the iOS app in the form of C++ dynamic libraries. This was great news because it helped us integrate a well functioning and thoroughly tested synchronization algorithm into the new product. We should also mention that we chose to build a Windows Universal app for their App Store. We have enabled Xamarin Insights to report stack traces back to us in case any users in the field experience app crashes. And here is where our woes begin.

When there is an occasional crash in a native library, we got stack traces that did not mean much. Insights reported the C# stack frames perfectly but for the native C++ code, it would simply display a hex address. And as all of you know, not all crashes are always reproducible on your end (even though, customers experience these crashes in the field) and these issues are a nightmare to debug because we are essentially looking for a cause without any clues.

We have spent a lot of time trying to integrate a better crash reporting framework (HockeyApp has been a great find … but then again, it only reports C# stacks. we were so frustrated, we got in touch with Microsoft folks responsible for HockeyApp to find out if there is a secret option we needed to enable. But they told us they can’t get to the native frames because there is not an SDK that lets them capture those stack frames. At this point, we pretty much have given up hope but found a magic lens via Windows Dev Center. When you go to the Windows dev center to manage your store listing, you have a Dashboard screen. There, you can actually find all your crashes and the stack frames associated with it. And to our pleasant surprise, even native stacks are reported. We are attaching a couple of screenshots here to help you find this secret treasure trove of information. As developers, we are sure you would be very happy to know there is at least a way to understand those mysterious crashes you can’t reproduce! Hope you find this post helpful because we certainly could have used it when we were scouring the web for help!

Happy Coding!

Follow Us for More Exciting Updates!

As we continue to innovate and enhance our software, we invite you to stay connected and be the first to know about future releases, product tips, and much more! Follow our blog to access in-depth articles, engaging tutorials, and expert perspectives that empower you to make the most of our software’s capabilities.

Connect with us on our social media channels to become part of a vibrant community of like-minded individuals. Share your experiences, provide feedback, and join the conversation as we collectively shape the future of software innovation.