Blocks and methods should only have the unsafe
keyword when pointers are used inside.
Pointer usage is detected when a Pointer-Type(TYPE*
), the pointer indirection operator (*variable
), an address operator (&variable
) or the member access operator (->
) is used.
Pointer usage is also detected when calling a method that was declared with the unsafe
modifier.
Pointer usage is also detected when calling a method/ using a property/field of an object and the result will be a pointer type.
You can also use the provided automatic Code Fix to remove the unsafe
keyword. ( Press Alt + Enter on the Error line to find the Code Fix in the context menu)
Remove the unsafe
keyword.