Debug Error,qstringview.h Line:179,ASSERT:"len>=0" in file
-
@fredmarks
Your code is doing something wrong with a string. If this happens on a development machine with VS installed, do as it says at the end, click Retry, it should take you into debugger at the fault, look in the stack view pane to see where in your code it was called from.Otherwise you can try/hope it goes wrong when you repeatedly run it under debugger.
There is no "magic wand" for errors which are "No everytime". It might stem from an uninitialized variable which shows up in different ways, or in certain circumstances.
If I had to guess the
ASSERT
comes from the line at https://codebrowser.dev/qt5/qtbase/src/corelib/text/qstringview.h.html#175Q_DECL_CONSTEXPR QStringView(const Char *str, qsizetype len) : m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)),
A
QStringView
is being created from aconst Char *
where the passed-inlen
is negative. Qt may be calling this indirectly from other code, but if you do createQStringView
s look at that.