PointerLike stuffnew(ref x) instead of ref xPointerLike itself a ref struct that can track its own refs
PointerLikePointerLikenew(ref x)ref xref structusing static Silk.NET.INSANITY;
public class MyClass {
public void thing() {
glGenBuffer(GL_VERTEX_BUFFER);
}
}int* x = default;
{
int y;
x = &y;
}
// y is out of scope thus x's "lifetime" has been exceededSpan<int> x = default;
{
int y = default;
x = MemoryMarshal.AsSpan(ref y, 1);
}
// y is out of scope thus x's "lifetime" has been exceeded