diff --git a/src/Common/src/NativeMethods.cs b/src/Common/src/NativeMethods.cs
index 87a75547f81..1c01ae0a4ab 100644
--- a/src/Common/src/NativeMethods.cs
+++ b/src/Common/src/NativeMethods.cs
@@ -46,7 +46,6 @@ namespace System.Windows.Forms {
using Accessibility;
using System.Runtime.InteropServices;
using System;
- using System.Security.Permissions;
using System.Collections;
using System.Diagnostics;
using System.IO;
diff --git a/src/Common/src/UnsafeNativeMethods.cs b/src/Common/src/UnsafeNativeMethods.cs
index 02ee007570d..a0e9df13134 100644
--- a/src/Common/src/UnsafeNativeMethods.cs
+++ b/src/Common/src/UnsafeNativeMethods.cs
@@ -8128,16 +8128,10 @@ public interface IRawElementProviderHwndOverride : IRawElementProviderSimple {
IRawElementProviderSimple GetOverrideProviderForHwnd(IntPtr hwnd);
}
- ///
- /// Critical:Elevates to Unmanaged code permission
- ///
[ComImport()]
[Guid("6D5140C1-7436-11CE-8034-00AA006009FA")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IServiceProvider {
- ///
- /// Critical elevates via a SUC.
- ///
[PreserveSig]
int QueryService(ref Guid service, ref Guid riid, out IntPtr ppvObj);
}
diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.cs
index 04c71708a34..3e45fede73f 100644
--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.cs
+++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/BehaviorService.cs
@@ -1203,10 +1203,6 @@ private bool ProcessMouseMessage(IntPtr hWnd, int msg, int x, int y)
{
return false;
}
- // We could have hooked a control in a semitrust web page. This would put semitrust frames above us, which could cause this to fail.
- // SECREVIEW, UNDONE. Think hard about this. Does this allow a project to have a web page that pointed to a malicious control?
- // I don't think so, because the malicious control would still be on the frame.
- new NamedPermissionSet("FullTrust").Assert();
foreach (AdornerWindow adornerWindow in AdornerWindow.s_adornerWindowList)
{
diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesignerUtils.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesignerUtils.cs
index 49a0d1c16d2..1041b29a29a 100644
--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesignerUtils.cs
+++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripDesignerUtils.cs
@@ -12,7 +12,6 @@
using System.Drawing.Design;
using System.Reflection;
using System.Security;
-using System.Security.Permissions;
using System.Windows.Forms.Design.Behavior;
using Microsoft.Win32;
@@ -539,24 +538,16 @@ public static short BitsPerPixel
{
if (s_bitsPerPixel == 0)
{
- new EnvironmentPermission(PermissionState.Unrestricted).Assert();
- try
+ foreach (Screen s in Screen.AllScreens)
{
- foreach (Screen s in Screen.AllScreens)
+ if (s_bitsPerPixel == 0)
{
- if (s_bitsPerPixel == 0)
- {
- s_bitsPerPixel = (short)s.BitsPerPixel;
- }
- else
- {
- s_bitsPerPixel = (short)Math.Min(s.BitsPerPixel, s_bitsPerPixel);
- }
+ s_bitsPerPixel = (short)s.BitsPerPixel;
+ }
+ else
+ {
+ s_bitsPerPixel = (short)Math.Min(s.BitsPerPixel, s_bitsPerPixel);
}
- }
- finally
- {
- CodeAccessPermission.RevertAssert();
}
}
return s_bitsPerPixel;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/AccessibleObject.cs b/src/System.Windows.Forms/src/System/Windows/Forms/AccessibleObject.cs
index 789f12c4253..b41ed8f6cd1 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/AccessibleObject.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/AccessibleObject.cs
@@ -2703,7 +2703,7 @@ internal sealed class InternalAccessibleObject : StandardOleMarshalObject,
private UnsafeNativeMethods.IRawElementProviderHwndOverride publicIRawElementProviderHwndOverride; // AccessibleObject as IRawElementProviderHwndOverride
///
- /// Create a new wrapper. Protect this with UnmanagedCode Permission
+ /// Create a new wrapper.
///
internal InternalAccessibleObject(AccessibleObject accessibleImplemention)
{
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs
index b0d7c3706d2..619d1e72229 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs
@@ -2501,8 +2501,6 @@ internal ParkingWindow GetParkingWindow(DpiAwarenessContext context) {
var parkingWindow = GetParkingWindowForContext(context);
if (parkingWindow == null) {
#if DEBUG
- // if we use Debug.WriteLine instead of "if", we need extra security permissions
- // to get the stack trace!
if (CoreSwitches.PerfTrack.Enabled) {
Debug.WriteLine("Creating parking form!");
Debug.WriteLine(CoreSwitches.PerfTrack.Enabled, Environment.StackTrace);
@@ -2578,8 +2576,6 @@ internal Control MarshalingControl {
lock (this) {
if (marshalingControl == null) {
#if DEBUG
- // if we use Debug.WriteLine instead of "if", we need extra security permissions
- // to get the stack trace!
if (CoreSwitches.PerfTrack.Enabled) {
Debug.WriteLine("Creating marshalling control!");
Debug.WriteLine(CoreSwitches.PerfTrack.Enabled, Environment.StackTrace);
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/AutoCompleteStringCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/AutoCompleteStringCollection.cs
index 20235c076d5..476a07e7610 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/AutoCompleteStringCollection.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/AutoCompleteStringCollection.cs
@@ -7,7 +7,6 @@ namespace System.Windows.Forms {
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Collections;
- using System.Security.Permissions;
using System.ComponentModel;
///
@@ -210,7 +209,6 @@ public void RemoveAt(int index) {
/// Gets an object that can be used to synchronize access to the .
///
public object SyncRoot {
- [HostProtection(Synchronization=true)]
[SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")]
get {
return this;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs
index 5e7c6cc12eb..f24c8090433 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs
@@ -6262,16 +6262,6 @@ public Control GetChildAtPoint(Point pt, GetChildAtPointSkip skipValue) {
IntPtr hwnd = UnsafeNativeMethods.ChildWindowFromPointEx(new HandleRef(null, Handle), pt.X, pt.Y, value);
- // Security Reviewed
- // While doing a security review it was noticed that GetChildAtPoint
- // does work to ensure that you can only gain access to children of your own control,
- // but the methods it uses to determine the children demand all window permission first,
- // negating the extra check.
- // It is OK to return child windows for children within your own control for semitrust.
-
- // Hence calling the Internal methods to ByPass the Security Demand...
- // for IntSecurity.ControlFromHandleOrLocation == ALLWindows.
-
Control ctl = FromChildHandleInternal(hwnd);
return(ctl == this) ? null : ctl;
@@ -6804,7 +6794,7 @@ public Control GetNextControl(Control ctl, bool forward) {
///
/// Return ((Control) window).Handle if window is a Control.
- /// Otherwise, demands permission for AllWindows and returns window.Handle
+ /// Otherwise, returns window.Handle
///
internal static IntPtr GetSafeHandle(IWin32Window window)
{
@@ -16435,9 +16425,7 @@ internal void InPlaceActivate(int verb)
this.hwndParent = hwndParent;
UnsafeNativeMethods.SetParent(new HandleRef(control, control.Handle), new HandleRef(null, hwndParent));
- // Now create our handle if it hasn't already been done. Note that because
- // this raises events to the user that it CANNOT be done with a security assertion
- // in place!
+ // Now create our handle if it hasn't already been done.
//
control.CreateControl();
@@ -18601,8 +18589,6 @@ public ControlAccessibleObject(Control ownerControl) {
this.ownerControl = ownerControl;
- // call get_Handle outside the UnmanagedCode permission because if the handle is not created yet,
- // we will invoke 3rd party HandleCreated event handlers
IntPtr handle = ownerControl.Handle;
this.Handle = handle;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/DataGridViewComboBoxEditingControl.cs b/src/System.Windows.Forms/src/System/Windows/Forms/DataGridViewComboBoxEditingControl.cs
index 3487b997d09..77f24dc58d7 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/DataGridViewComboBoxEditingControl.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/DataGridViewComboBoxEditingControl.cs
@@ -9,7 +9,6 @@ namespace System.Windows.Forms
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
- using Security.Permissions;
///
[
@@ -207,7 +206,6 @@ public DataGridViewComboBoxEditingControlAccessibleObject(DataGridViewComboBoxEd
public override AccessibleObject Parent
{
- [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
get
{
return _parentAccessibleObject;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/DisplayInformation.cs b/src/System.Windows.Forms/src/System/Windows/Forms/DisplayInformation.cs
index 0e87fb85169..c9bb8ac8044 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/DisplayInformation.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/DisplayInformation.cs
@@ -7,7 +7,6 @@
namespace System.Windows.Forms {
using Microsoft.Win32;
using System.Security;
- using System.Security.Permissions;
internal class DisplayInformation {
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/DropTarget.cs b/src/System.Windows.Forms/src/System/Windows/Forms/DropTarget.cs
index 9ed78eb1a04..b98e1d96613 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/DropTarget.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/DropTarget.cs
@@ -6,7 +6,6 @@ namespace System.Windows.Forms
{
using System;
using System.Diagnostics;
- using System.Security.Permissions;
using System.Security;
using System.ComponentModel;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/FileDialog.cs b/src/System.Windows.Forms/src/System/Windows/Forms/FileDialog.cs
index 80d2e00f7c5..c9f42eec620 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/FileDialog.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/FileDialog.cs
@@ -391,10 +391,7 @@ public string InitialDirectory {
/// Gets the Win32 instance handle for the application.
///
///
- /* SECURITYUNDONE : should require EventQueue permission */
protected virtual IntPtr Instance {
-
-
get { return UnsafeNativeMethods.GetModuleHandle(null); }
}
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/FileDialogCustomPlace.cs b/src/System.Windows.Forms/src/System/Windows/Forms/FileDialogCustomPlace.cs
index 49000bc28f5..c3129c0b60a 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/FileDialogCustomPlace.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/FileDialogCustomPlace.cs
@@ -5,7 +5,6 @@
using System;
using System.IO;
using System.Security;
-using System.Security.Permissions;
using System.Text;
namespace System.Windows.Forms
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs b/src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs
index e0fa1be03ad..7aadefea080 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs
@@ -15,7 +15,6 @@ namespace System.Windows.Forms
using System.Drawing.Design;
using System.Diagnostics;
using System.Runtime.InteropServices;
- using System.Security.Permissions;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Win32.SafeHandles;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs
index 1732c698249..0529ced7681 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs
@@ -4153,8 +4153,6 @@ protected override void OnEnabledChanged(EventArgs e) {
// Make sure we activate the active control.
Control activeControl = ActiveControl;
- // Seems safe to call this here without demanding permissions, since we only
- // get here if this form is enabled and active.
if( activeControl == null ){
SelectNextControlInternal(this, true, true, true, true);
}
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/FxCopSuppression.cs b/src/System.Windows.Forms/src/System/Windows/Forms/FxCopSuppression.cs
index 0bbf683d4b1..22ebcb18c08 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/FxCopSuppression.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/FxCopSuppression.cs
@@ -480,15 +480,6 @@
// InProc SxS Supperssions: Methods wich consume but not expose resources
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Resources.AssemblyNamesTypeResolutionService.#GetType(System.String,System.Boolean,System.Boolean)")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Resources.ResXResourceReader.#EnsureResData()")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManager.#GetZonePromptingLevel(System.String)")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManager.#get_DefaultBrowserExePath()")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManagerMoreInformation.#.ctor(System.Security.Policy.TrustManagerPromptOptions,System.String)")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManagerMoreInformation.#LoadWarningBitmap(System.Security.Policy.TrustManagerWarningLevel,System.Windows.Forms.PictureBox)")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManagerMoreInformation.#OnUserPreferenceChanged(System.Object,Microsoft.Win32.UserPreferenceChangedEventArgs)")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManagerPromptUI.#LoadGlobeBitmap()")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManagerPromptUI.#LoadWarningBitmap(System.Security.Policy.TrustManagerWarningLevel)")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManagerPromptUI.#TrustManagerPromptUI_ShowSupportPage(System.Object,System.Windows.Forms.LinkLabelLinkClickedEventArgs)")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Security.Policy.TrustManagerPromptUI.#UpdateFonts()")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Application+ComponentManager.#System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(System.Int32,System.Int32,System.Int32)")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Application+ModalApplicationContext.#DisableThreadWindows(System.Boolean,System.Boolean)")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Application+ParkingWindow.#CheckDestroy()")]
@@ -951,7 +942,6 @@
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Internal.WindowsGraphics.#GetTextExtent(System.String,System.Windows.Forms.Internal.WindowsFont)")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Internal.WindowsGraphics.#GetTextMetrics()")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Internal.WindowsGraphics.#MeasureText(System.String,System.Windows.Forms.Internal.WindowsFont,System.Drawing.Size,System.Windows.Forms.Internal.IntTextFormatFlags)")]
-[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.IntSecurity.#DemandFileIO(System.Security.Permissions.FileIOPermissionAccess,System.String)")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Label.#Dispose(System.Boolean)")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Label.#GetLeadingTextPaddingFromTextFormatFlags()")]
[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Label.#GetPreferredSizeCore(System.Drawing.Size)")]
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/HtmlElementCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/HtmlElementCollection.cs
index 15469934835..e45f73defd1 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/HtmlElementCollection.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/HtmlElementCollection.cs
@@ -9,7 +9,6 @@
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
-using System.Security.Permissions;
using System.Security;
using System.Runtime.InteropServices;
using System.Net;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/HtmlToClrEventProxy.cs b/src/System.Windows.Forms/src/System/Windows/Forms/HtmlToClrEventProxy.cs
index 5a400b65825..715816c867b 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/HtmlToClrEventProxy.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/HtmlToClrEventProxy.cs
@@ -9,7 +9,6 @@
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
-using System.Security.Permissions;
using System.Security;
using System.Runtime.InteropServices;
using System.Net;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/HtmlWindowCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/HtmlWindowCollection.cs
index 721c7c17322..56823b69024 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/HtmlWindowCollection.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/HtmlWindowCollection.cs
@@ -9,7 +9,6 @@
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
-using System.Security.Permissions;
using System.Security;
using System.Runtime.InteropServices;
using System.Net;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElementCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElementCollection.cs
index 01cff25945a..05f439e73ed 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElementCollection.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/Layout/ArrangedElementCollection.cs
@@ -5,7 +5,6 @@
namespace System.Windows.Forms.Layout {
using System.Collections;
- using System.Security.Permissions;
///
public class ArrangedElementCollection : IList
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ListView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ListView.cs
index 5a01c8e9dd1..00a47209775 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ListView.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ListView.cs
@@ -2771,8 +2771,6 @@ unsafe void CustomDraw(ref Message m) {
private void DeleteFileName(string fileName) {
if (!string.IsNullOrEmpty(fileName)) {
- // the list view needs the FileIOPermission when the app runs on an UNC share
- // and the list view creates / destroys temporary files for its background image
System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
if (fi.Exists) {
@@ -2865,9 +2863,7 @@ protected override void Dispose(bool disposing) {
}
if (!string.IsNullOrEmpty(this.backgroundImageFileName) || this.bkImgFileNames != null) {
- // we need the fileIoPermission when the app runs on an UNC share and
- // the list view creates/deletes temporary files for its background image
-
+
System.IO.FileInfo fi;
if (!string.IsNullOrEmpty(this.backgroundImageFileName)) {
fi = new System.IO.FileInfo(this.backgroundImageFileName);
@@ -4638,9 +4634,6 @@ private void SetBackgroundImage() {
if (this.BackgroundImage != null) {
- // the list view needs these permissions when the app runs on an UNC share
- // and the list view creates / destroys temporary files for its background image
-
// save the image to a temporary file name
string tempDirName = System.IO.Path.GetTempPath();
System.Text.StringBuilder sb = new System.Text.StringBuilder(1024);
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ListViewGroupItemCollection.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ListViewGroupItemCollection.cs
index c3d8f3187db..f24a5e4fc45 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ListViewGroupItemCollection.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ListViewGroupItemCollection.cs
@@ -5,7 +5,6 @@
using System.ComponentModel;
using System.Diagnostics;
using System;
-using System.Security.Permissions;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel.Design;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/MaskedTextBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/MaskedTextBox.cs
index d88d9b88b45..b19b83ba886 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/MaskedTextBox.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/MaskedTextBox.cs
@@ -1263,10 +1263,6 @@ private char SystemPasswordChar
throw;
}
}
- finally
- {
- CodeAccessPermission.RevertAssert();
- }
MaskedTextBox.systemPwdChar = foundRsc ? (char) int.Parse(charVal.ToString()) : MaskedTextProvider.DefaultPasswordChar;
*/
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/NumericUpDown.cs b/src/System.Windows.Forms/src/System/Windows/Forms/NumericUpDown.cs
index 9cfb0d2fd0f..2fac9afd0ac 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/NumericUpDown.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/NumericUpDown.cs
@@ -13,7 +13,6 @@ namespace System.Windows.Forms {
using System.Windows.Forms.Internal;
using System.Globalization;
using System.Runtime.InteropServices;
- using System.Security.Permissions;
using System.Windows.Forms.Layout;
///
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PageSetupDialog.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PageSetupDialog.cs
index ea164ad6cae..c8cba113167 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PageSetupDialog.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PageSetupDialog.cs
@@ -313,7 +313,6 @@ private bool ShouldSerializeMinMargins() {
private static void UpdateSettings(NativeMethods.PAGESETUPDLG data, PageSettings pageSettings,
PrinterSettings printerSettings) {
- // SetHDevMode demands AllPrintingAndUnmanagedCode Permission : Since we are calling that function we should Assert the permision,
pageSettings.SetHdevmode(data.hDevMode);
if (printerSettings != null) {
printerSettings.SetHdevmode(data.hDevMode);
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.cs
index d4779cc9608..67d0fa3daa2 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/Printing/PrintPreviewControl.cs
@@ -451,7 +451,6 @@ private void ComputePreview() {
document.PrintController = new PrintControllerWithStatusDialog(previewController,
string.Format(SR.PrintControllerWithStatusDialog_DialogTitlePreview));
- // Want to make sure we've reverted any security asserts before we call Print -- that calls into user code
document.Print();
pageInfo = previewController.GetPreviewPageInfo();
Debug.Assert(pageInfo != null, "ReviewPrintController did not give us preview info");
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/SplitterPanel.cs b/src/System.Windows.Forms/src/System/Windows/Forms/SplitterPanel.cs
index 8db2dbaf699..3bc0fa9a4b5 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/SplitterPanel.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/SplitterPanel.cs
@@ -10,7 +10,6 @@ namespace System.Windows.Forms {
using System.ComponentModel;
using System.Diagnostics;
using System.Security;
- using System.Security.Permissions;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Design;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/TabPage.cs b/src/System.Windows.Forms/src/System/Windows/Forms/TabPage.cs
index ca4db4ba814..462601b21b9 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/TabPage.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/TabPage.cs
@@ -12,7 +12,6 @@ namespace System.Windows.Forms {
using System.ComponentModel.Design;
using System.Text;
using System.Windows.Forms;
- using System.Security.Permissions;
using Microsoft.Win32;
using System.Windows.Forms.VisualStyles;
using System.Runtime.InteropServices;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripComboBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripComboBox.cs
index 50fbfd33309..8fef09882d3 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripComboBox.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripComboBox.cs
@@ -13,7 +13,6 @@ namespace System.Windows.Forms {
using System.Drawing.Drawing2D;
using System.Windows.Forms.Design;
using System.Security;
- using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Windows.Forms.Internal;
using System.Globalization;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDownMenu.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDownMenu.cs
index 7027d46aaed..30e8e6f8425 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDownMenu.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDownMenu.cs
@@ -15,7 +15,6 @@ namespace System.Windows.Forms {
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
- using System.Security.Permissions;
using System.Windows.Forms.Internal;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripOverflow.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripOverflow.cs
index 8e3cad6fc77..e92ed7c731a 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripOverflow.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripOverflow.cs
@@ -11,7 +11,6 @@ namespace System.Windows.Forms {
using System.Diagnostics.CodeAnalysis;
using System.Windows.Forms.Layout;
using System.Security;
- using System.Security.Permissions;
using System.Runtime.InteropServices;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripProgressBar.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripProgressBar.cs
index f080f647e4f..b1b817eda7c 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripProgressBar.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripProgressBar.cs
@@ -9,7 +9,6 @@ namespace System.Windows.Forms {
using System.ComponentModel;
using System.Drawing;
using System.Security;
- using System.Security.Permissions;
///
[DefaultProperty(nameof(Value))]
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripStatusLabel.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripStatusLabel.cs
index 5b365cf55e0..670fba06743 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripStatusLabel.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripStatusLabel.cs
@@ -9,7 +9,6 @@ namespace System.Windows.Forms {
using System.Drawing.Design;
using System.Diagnostics;
using System.Windows.Forms.ButtonInternal;
- using System.Security.Permissions;
using System.Security;
using System.Windows.Forms.Layout;
using System.Windows.Forms.Design;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripTextBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripTextBox.cs
index 5a6bd1c5358..555da5039b7 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripTextBox.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripTextBox.cs
@@ -13,7 +13,6 @@ namespace System.Windows.Forms {
using System.Runtime.InteropServices;
using System.Windows.Forms.Design;
using System.Security;
- using System.Security.Permissions;
using Microsoft.Win32;
///
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowser.cs b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowser.cs
index 8ebc2148518..8fa9dae5bb7 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowser.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowser.cs
@@ -1636,10 +1636,6 @@ private UnsafeNativeMethods.IWebBrowser2 AxIWebBrowser2 {
//
// WebBrowserSite class:
//
- //
- // We slap InheritanceDemand on this class so that only users with
- // UnmanagedCode permissions can override this type.
- //
///
///
///
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserBase.cs b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserBase.cs
index b6cef1a71ce..421e072c86a 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserBase.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserBase.cs
@@ -148,10 +148,6 @@ public object ActiveXInstance {
// ActiveX wrapper controls that derive from this class should override the
// below method and return their own WebBrowserSiteBaseBase derived object.
//
- // This method is protected by an InheritanceDemand because extending a
- // site is strictly an advanced feature for which one needs UnmanagedCode
- // permissions.
- //
///
///
///
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserContainer.cs b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserContainer.cs
index d5792594c20..0f910270ea8 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserContainer.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserContainer.cs
@@ -8,7 +8,6 @@
using System;
using System.Reflection;
using System.Globalization;
-using System.Security.Permissions;
using System.Collections;
using System.Drawing;
using System.Windows.Forms.Design;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserHelper.cs b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserHelper.cs
index bead9bba212..26a4eb9c01d 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserHelper.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserHelper.cs
@@ -13,7 +13,6 @@
using System;
using System.Reflection;
using System.Globalization;
-using System.Security.Permissions;
using Microsoft.Win32;
using System.Collections;
using System.Collections.Specialized;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserSiteBase.cs b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserSiteBase.cs
index c30cf9137a5..449268d302b 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserSiteBase.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserSiteBase.cs
@@ -13,7 +13,6 @@
using System;
using System.Reflection;
using System.Globalization;
-using System.Security.Permissions;
using Microsoft.Win32;
using System.Collections;
using System.Collections.Specialized;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/control.ime.cs b/src/System.Windows.Forms/src/System/Windows/Forms/control.ime.cs
index 8fbf9c16a1a..c8d8f6ee32c 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/control.ime.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/control.ime.cs
@@ -19,7 +19,6 @@ namespace System.Windows.Forms {
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Globalization;
- using System.Security.Permissions;
using System.Security;
using System.IO;
using System.Reflection;
diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/formatter.cs b/src/System.Windows.Forms/src/System/Windows/Forms/formatter.cs
index 07c8139fad9..b18abba5fa0 100644
--- a/src/System.Windows.Forms/src/System/Windows/Forms/formatter.cs
+++ b/src/System.Windows.Forms/src/System/Windows/Forms/formatter.cs
@@ -9,7 +9,6 @@ namespace System.Windows.Forms
using System.Globalization;
using System.Reflection;
using System.Security;
- using System.Security.Permissions;
internal class Formatter
{
diff --git a/src/System.Windows.Forms/src/misc/WeakHashtable.cs b/src/System.Windows.Forms/src/misc/WeakHashtable.cs
index e64e62ec50f..061870c50b7 100644
--- a/src/System.Windows.Forms/src/misc/WeakHashtable.cs
+++ b/src/System.Windows.Forms/src/misc/WeakHashtable.cs
@@ -6,14 +6,12 @@ namespace System.ComponentModel {
using System;
using System.Collections;
- using System.Security.Permissions;
///
/// This is a hashtable that stores object keys as weak references.
/// It monitors memory usage and will periodically scavenge the
/// hash table to clean out dead references.
///
- [HostProtection(SharedState = true)]
internal sealed class WeakHashtable : Hashtable
{
private static IEqualityComparer _comparer = new WeakKeyComparer();