Skip to content

Commit 7f176a8

Browse files
authored
Remove CAS attributes - System.Windows (#8013)
1 parent 247d3cd commit 7f176a8

File tree

17 files changed

+33
-51
lines changed

17 files changed

+33
-51
lines changed

snippets/csharp/System.Windows.Automation.Provider/IRangeValueProvider/IsReadOnly/CustomControl.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Text;
77
using System.Windows.Forms;
88
using System.Windows.Automation.Provider;
9-
using System.Security.Permissions;
109

1110
namespace UIAIRangeValueProvider_snip
1211
{
@@ -71,7 +70,6 @@ protected bool AutomationIsActive
7170
/// </summary>
7271
/// <param name="winMessage">Windows message.</param>
7372
/// <remarks>This method enables UI Automation to find the control.</remarks>
74-
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
7573
protected override void WndProc(ref Message m)
7674
{
7775
const int WM_GETOBJECT = 0x003D;

snippets/csharp/System.Windows.Automation.Provider/ISelectionItemProvider/AddToSelection/CustomControl.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
using System.Collections;
3434
using System.Windows.Automation.Provider;
3535
using System.Windows.Automation;
36-
using System.Security.Permissions;
3736

3837
namespace CustomControls
3938
{
@@ -362,7 +361,6 @@ internal Rectangle GetRectForItem(int index)
362361
/// <param name="msg">The Windows message.</param>
363362
/// <param name="keyData">Information about the key press.</param>
364363
/// <returns>true if successful.</returns>
365-
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
366364
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
367365
{
368366
if (keyData == Keys.Down)
@@ -445,7 +443,6 @@ protected bool AutomationIsActive
445443
/// </summary>
446444
/// <param name="winMessage">Windows message.</param>
447445
/// <remarks>This method enables UI Automation to find the control.</remarks>
448-
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
449446
protected override void WndProc(ref Message m)
450447
{
451448
const int WM_GETOBJECT = 0x003D;

snippets/csharp/System.Windows.Automation.Provider/IToggleProvider/Toggle/CustomControl.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Drawing;
99
using System.Windows.Automation.Provider;
1010
using System.Windows.Automation;
11-
using System.Security.Permissions;
1211

1312
namespace UIAIToggleProvider_snip
1413
{
@@ -100,7 +99,6 @@ protected bool AutomationIsActive
10099
/// </summary>
101100
/// <param name="winMessage">Windows message.</param>
102101
/// <remarks>This method enables UI Automation to find the control.</remarks>
103-
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
104102
protected override void WndProc(ref Message m)
105103
{
106104
const int WM_GETOBJECT = 0x003D;

snippets/csharp/System.Windows.Automation.Provider/ITransformProvider/CanMove/CustomControl.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Windows.Forms;
88
using System.Windows.Automation.Provider;
99
using System.Windows.Automation;
10-
using System.Security.Permissions;
1110

1211
namespace UIAITransformProvider_snip
1312
{
@@ -81,7 +80,6 @@ protected bool AutomationIsActive
8180
/// </summary>
8281
/// <param name="winMessage">Windows message.</param>
8382
/// <remarks>This method enables UI Automation to find the control.</remarks>
84-
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
8583
protected override void WndProc(ref Message m)
8684
{
8785
const int WM_GETOBJECT = 0x003D;

snippets/csharp/System.Windows.Automation.Provider/IValueProvider/IsReadOnly/CustomControl.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Windows.Forms;
77
using System.Drawing;
88
using System.Windows.Automation.Provider;
9-
using System.Security.Permissions;
109

1110
namespace UIAIValueProvider_snip
1211
{
@@ -86,7 +85,6 @@ protected bool AutomationIsActive
8685
/// </summary>
8786
/// <param name="winMessage">Windows message.</param>
8887
/// <remarks>This method enables UI Automation to find the control.</remarks>
89-
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
9088
protected override void WndProc(ref Message m)
9189
{
9290
const int WM_GETOBJECT = 0x003D;

snippets/csharp/System.Windows.Automation/StructureChangedEventArgs/.ctor/CustomControl.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ internal Rectangle GetRectForItem(int index)
362362
/// <param name="msg">The Windows message.</param>
363363
/// <param name="keyData">Information about the key press.</param>
364364
/// <returns>true if successful.</returns>
365-
[PermissionSetAttribute(SecurityAction.Demand, Unrestricted = true)]
366365
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
367366
{
368367
if (keyData == Keys.Down)
@@ -445,7 +444,6 @@ protected bool AutomationIsActive
445444
/// </summary>
446445
/// <param name="winMessage">Windows message.</param>
447446
/// <remarks>This method enables UI Automation to find the control.</remarks>
448-
[PermissionSetAttribute(SecurityAction.Demand, Unrestricted = true)]
449447
protected override void WndProc(ref Message winMessage)
450448
{
451449
const int WM_GETOBJECT = 0x003D;

snippets/csharp/System.Windows.Interop/D3DImage/Overview/window1.xaml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
using System.Windows.Shapes;
1616
using System.Windows.Threading;
1717
using System.Runtime.InteropServices;
18-
using System.Security.Permissions;
1918

2019
namespace D3DHost
2120
{
@@ -214,11 +213,10 @@ public POINT(Point p)
214213

215214
public static class HRESULT
216215
{
217-
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
218216
public static void Check(int hr)
219217
{
220218
Marshal.ThrowExceptionForHR(hr);
221219
}
222220
}
223221
}
224-
// </snippet1>
222+
// </snippet1>

snippets/csharp/System.Windows.Media.Effects/BitmapEffect/CreateBitmapEffectOuter/RGBFilterBitmapEffect.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Runtime.InteropServices;
66
using Microsoft.Win32.SafeHandles;
77
using System.Reflection;
8-
using System.Security.Permissions;
98

109
namespace RGBFilter
1110
{
@@ -23,7 +22,6 @@ protected override bool ReleaseHandle()
2322
}
2423
}
2524

26-
//
2725
public class Ole32Methods
2826
{
2927
[DllImport("ole32.dll")]
@@ -38,9 +36,7 @@ public class Ole32Methods
3836
//<SnippetBitmapEffectClass>
3937
public class RGBFilterBitmapEffect : BitmapEffect
4038
{
41-
4239
//<SnippetCreateUnmanagedEffect>
43-
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
4440
unsafe protected override SafeHandle CreateUnmanagedEffect()
4541
{
4642
const uint CLSCTX_INPROC_SERVER = 1;

snippets/csharp/System.Windows.Media.Effects/BitmapEffect/CreateBitmapEffectOuter/RGBFilterBitmapEffect.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
1+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
22
<PropertyGroup>
33
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
44
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,8 +10,9 @@
1010
<OutputType>library</OutputType>
1111
<ApplicationVersion>1.0.0.*</ApplicationVersion>
1212
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
13-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14-
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
13+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
14+
<TargetFrameworkProfile>
15+
</TargetFrameworkProfile>
1516
<ProductVersion>10.0.20821</ProductVersion>
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -21,13 +22,15 @@
2122
<OutputPath>.\bin\Debug\</OutputPath>
2223
<DefineConstants>DEBUG;TRACE</DefineConstants>
2324
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
25+
<Prefer32Bit>false</Prefer32Bit>
2426
</PropertyGroup>
2527
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2628
<DebugSymbols>false</DebugSymbols>
2729
<Optimize>true</Optimize>
2830
<OutputPath>.\bin\Release\</OutputPath>
2931
<DefineConstants>TRACE</DefineConstants>
3032
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
33+
<Prefer32Bit>false</Prefer32Bit>
3134
</PropertyGroup>
3235
<ItemGroup>
3336
<Reference Include="System" />

snippets/csharp/System.Windows.Media.Imaging/BitmapCodecInfo/Overview/BitmapFrame.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Windows.Media;
77
using System.Windows.Media.Imaging;
88
using System.Threading;
9-
using System.Security.Permissions;
109
using System.Collections.ObjectModel;
1110

1211
namespace SDKSample
@@ -20,7 +19,7 @@ protected override void OnStartup (StartupEventArgs e)
2019
base.OnStartup (e);
2120
CreateAndShowMainWindow ();
2221
}
23-
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
22+
2423
private void CreateAndShowMainWindow ()
2524
{
2625

@@ -215,4 +214,4 @@ private static void Main ()
215214
app.Run ();
216215
}
217216
}
218-
}
217+
}

0 commit comments

Comments
 (0)