Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System.Security.Policy.PolicyException ???

Status
Not open for further replies.

RichieMac

Programmer
Aug 18, 2004
61
GB
Hi all,

I'm trying to come to terms with pointers as I'm from a java background. I have a simple piece of code...

Code:
using System;

public class TestClass
{
	public unsafe static void Main ()
	{
		double d1 = 3.45;
		//double* pD = &d1;
		//double d2 = *pD;

		Console.WriteLine ("d1 :" + d1);
		Console.WriteLine ("&d1 :" + (int) &d1);
        //Console.WriteLine ("pD :" + (int) pD);
		//Console.WriteLine ("&pD :" + (int) &pD);

		//Console.WriteLine ("d2 :" + d2);
		//Console.WriteLine ("&d2 :" + (int) &d2);
	}
}

I compile it on the cmd line using...

csc /unsafe filemname.cs

When I try to run the .exe I get the following error...

Unhandled Exception: System.Security.Policy.PolicyException: Required permissions cannot be aquired

Any help will be gratefully received as I can't find a solution anywhere.

Thanks
Richie
 
The above error has nothing to do with the fact you are using pointers e.g. unsafe code.
I think that error is related to your .NET Framework installation or/and settings e.g. Control Panel->Administrative Tools->Microsoft .NET 1.x Configuration ->Run Time Security Policy.
Control Panel->Administrative Tools->Microsoft .NET 1.x Configuration Wizards->Adjust NET Security.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top