EnvironmentPermission

In a .NET Windows Forms application, you must have minimal “Read” EnvironmentPermission settings if your application uses the GetContextKeywords function.

The default setting is “Unrestricted=’true’” when the EnvironmentPermission check box is selected on the Security tab of the Project painter, although you can change this to “Read” and still use the GeContextKeywords function. If you modify the setting to “Write” or “NoAccess”, GetContextKeywords will fail.
EnvironmentPermission required in Windows Forms
System function Permission required
GetContextKeywords Read

Example 1

You can customize the EnvironmentPermission setting to allow the use of the GetContextKeywords function in XML, as in this sample setting:
<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" 
Read="Path " />