Iterator debugging asserts in mixed managed/native code
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.2k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
Describe the bug
Iterator debugging fires an assert in xmemory when the sample is built with mixed managed/unmanaged translation units. When everything is compiled as unmanaged the assert does not fire.
The sample involves a std::function passing across managed/unmanaged boundaries with placeholders for the iterators. The assert fires for foo from the managed code, but not bar from the unmanaged code. I would expect it to fire for both or neither.
Command-line test case
STL version (git commit or Visual Studio version): 0281a452293b4e9bd2a0b77cdd1a58ac63a9b086
Self contained test case is at:
https://github.com/ngoozeff/iter_test
Open a Visual Studio Command Prompt to the directory containing the checked out code from above, execute the run.cmd command. run2.cmd has some setup helpers for the include paths etc, you would need to adjust to your environment.
Expected behavior
Program runs cleanly.
Additional context
Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28105.4 for x64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the self-contained reproducer at https://github.com/ngoozeff/iter_test and run run.cmd from a Visual Studio Command Prompt. Inspect the xmemory iterator-debugging assertion and compare the managed and unmanaged std::function paths described in the issue. Done means the sample runs cleanly with consistent assertion behavior for foo and bar.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100