Pronunciation / adjective
Bringing something good and unforseen.
    Skip Navigation Links > Code Repository
   

Error: Unsafe code may only appear if compiling with /unsafe



 
Return

Error: Unsafe code may only appear if compiling with /unsafe

When a c# project needs to use pointers and memory management you need to declare your class as "unsafe". But then you experience the above error when compiling. To allow your code to compile do the following:

In VS.NET go to the project property page of the project that contains your class which is declared "unsafe" and in “configuration properties > build” set Allow Unsafe Code Blocks to True.

Return
Microsoft Certified Professional   © 2017 Fortunate.  All rights reserved.
contact: justin@aboutfortunate.com