0

Porting some code from .NET Framework to UWP, and I'm not sure how to replicate this in a UWP project:

StackFrame frame = new StackFrame(1);
var method = frame.GetMethod();
var names = method.Name.Split('_');
var propertyName = names.Length == 2 ? names[1] : names[0];

Any help?

Mercutio
  • 1,152
  • 1
  • 14
  • 33
  • You haven’t shown your problem yet. The code doesn’t compile at all, or you get an runtime error? Or it doesn’t work as expected? Or simply you don’t know if it is possible to port the code to UWP? – kennyzx Oct 31 '18 at 03:22

1 Answers1

4

If you are targetting UWP build minimum version less than 16299, you can't use StackFrame to achieve what you mentioned.

StackFrame was added later in .Net Standard 2.0 and was not part of the older version of .Net Standard, so in order to use .Net Standard 2.0 you need to update your UWP App minimum build version number to Fall Creators Update 16299.

Reference Links:

Github - Implement System.Diagnostics.StackTrace/StackFrame

.Net Standard 2.0 For UWP

Dishant
  • 1,545
  • 12
  • 29