EnvironmentPolicy.ThrowAlways() Method
Throws an exception when the DevExpress control accesses System.Environment
.
Namespace: DevExpress.Data.Utils
Assembly: DevExpress.Data.v24.2.dll
Declaration
Remarks
Call the ThrowAlways
method at application startup to apply a restrictive policy. Handle the Failed event to respond to associated failures.
using System;
using System.Windows.Forms;
namespace EnvironmentPolicyDemo {
internal static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DevExpress.Data.Utils.EnvironmentPolicy.ThrowAlways();
DevExpress.Data.Utils.EnvironmentPolicy.Failed += EnvironmentPolicy_Failed;
Application.Run(new Form1());
}
static void EnvironmentPolicy_Failed(object sender, DevExpress.Data.Utils.EnvironmentPolicy.FailedEventArgs e) {
Console.WriteLine(e.Exception.Message);
e.Throw = false;
}
}
}
Tip
Read the following topic for additional information: Environment Policy.
See Also