.NET P/Invoke Calling native code from .NET is powerful but unforgiving. Incorrect signatures, garbled strings, and leaked or freed memory are the most common sources of bugs — all can manifest as intermittent crashes, silent data corruption, or access violations far from the actual defect. This skill covers both (available since .NET Framework 1.0) and (source-generated, .NET 7+). When targeting .NET Framework, always use . When targeting .NET 7+, prefer for new code. When native AOT is a requirement, is the only option. When to Use This Skill - Writing a new or declaration from a C/C++ head…