I have a simple WinForms solution, with a Form that has a PropertyGrid in it. In Form's constructor, I set that propertyGrid's selected object:
public FormSettings()
{
InitializeComponent();
pgMisc.SelectedObject = Settings.Current;
}
And I'm getting this warning by Code Analysis:
Warning 1 CA2122 : Microsoft.Security : 'FormSettings.FormSettings()' calls into 'PropertyGrid.SelectedObject.set(object)' which has a LinkDemand. By making this call, 'PropertyGrid.SelectedObject.set(object)' is indirectly exposed to user code. Review the following call stack that might expose a way to circumvent security protection: ->'FormSettings.FormSettings()'
->'FormSettings.FormSettings()'
What am I doing wrong here? Is there a way to disable this warning if there's nothing I'm doing wrong.