'default.natstepfilter file not letting me avoid StepInto for templated/inline functions in Visual Studio 2019

I'm having problems using my default.natstepfilter to avoid "Stepping Into" functions when debugging in Visual Studio 2019.

Here are the relevant lines from the file:

  <Function><Name>PathFilename::PathFilename</Name><Action>NoStepInto</Action></Function>
  <Function><Name>to_string_with_decimals</Name><Action>NoStepInto</Action></Function>

Here are the relevant lines in my source code:

Header.h

// Class with constructor
class PathFilename
{
public:
    PathFilename(string i_Path_Filename = "", bool i_Ignore_Extension_Convention = false);
};

// inline function using templates
template <typename T>
inline string to_string_with_decimals(const T i_Value, const uint i_Precision = 1)
{
    // Stepping Into should never reach here (but it does)!
    std::ostringstream out;
    out << std::setprecision(i_Precision) << std::fixed << i_Value;
    return(out.str());
}

Main.cpp

PathFilename::PathFilename(string i_Path_Filename, bool i_Ignore_Extension_Convention)
{
    // Do stuff
    // Stepping Into should never reach here (and it doesn't)!

}

int main()
{
    // Debugging here
    PathFilename pf("foo.txt");     // Line A
    
    cout << to_string_with_decimals(1.05030, 2);    // Line B
}

The default.natstepfilter is respected by the debugger when it comes to PathFilename::PathFilename() - using StepInto while on "Line A" steps past the constructor, rather than into it. If I remove that line from the default.natstepfilter file, of course StepInto on "Line A" works as expected and steps in to the constructor.

However, even with the second line of default.natstepfilter, if I StepInto while on "Line B," the debugger goes in to to_string_with_decimals(), rather than stepping past it.

What am I doing wrong? I suspect it has something to do with the fact that it's function using a template, or perhaps because it's an inline function defined in a header file. But I have no idea how to get it to work so I don't step into this frequently-used utility function when debugging.

Any help would be appreciated. Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source