question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

github_iconTop GitHub Comments

2reactions
iSazonovcommented, Aug 28, 2020

For 1 case. StackAlloc is used only (1) ~for large output~, (2) if new line is needed, (3) once on last iteration - so we could add comment that it is safe to suppress.

For 2 case. We can move StackAlloc out the cycle.

For 3 case. We can remove the cycle and replace break-s with return-s.

2reactions
daxian-dbwcommented, Aug 27, 2020

Both first and second are real loops, no?

Read more comments on GitHub >

github_iconTop Results From Across the Web

CA2014: Do not use stackalloc in loops (code analysis)
If stackalloc is used in a loop, it can lead to stack overflows due to exhausting the stack memory. How to fix violations....
Read more >
Breaking change: CA2014: Do not use stackalloc in loops
Rule CA2014 looks for C# code where a stackalloc expression is used inside a loop. stackalloc allocates memory from the current stack frame....
Read more >
How do I find where I am using stackalloc in loops? ...
I just opened another of my projects which looks more like yours. When I tried to investigate, I found the possible confusion: The...
Read more >
Dos and Don'ts of stackalloc - Random Thoughts
DON'T: Use stackalloc in non-constant loops. Even if you allocate a fixed length amount of data on the stack, doing so in a...
Read more >
Automatically Identify Bugs in Your Code With .NET 5
The fix is to add AsSpan calls in this case: ... CA2014 — Do not use “stackalloc” in loops ... Warning CA2014 Potential...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found