winforms icon indicating copy to clipboard operation
winforms copied to clipboard

MissingMethodException from System.Security.Permissions when running application

Open ArrowCase opened this issue 7 years ago • 4 comments

This is an issue with running the hello world WinForms application after replacing the System.Windows.Forms binary with my locally built copy (i.e. to debug changes).

Steps followed:

  • Install .NET Core 3.0.0 Preview 1 SDK with x64 Installer (can't use latest build due to #249)
  • dotnet new winforms -o winformstest
  • Run winformstest with dotnet run

At this point, the hello world application starts up and everything is fine.

  • Build winforms repo locally per Developer Guide (completes with no errors or warnings)
  • Copy contents of winforms\artifacts\bin\System.Windows.Forms\Debug\netcoreapp3.0 to Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.0.0-alpha-27128-4
  • Run winformstest with dotnet run

Expected results:

The hello world application still runs successfully.

Actual results:

System.MissingMethodException: Method not found: 'Void System.Security.Permissions.FileIOPermission..ctor(System.Security.Permissions.PermissionState)'.
   at System.Windows.Forms.Application.EnableVisualStyles()
   at winformstest.Program.Main(String[] args) in C:\redacted\winformstest\Program.cs:line 20

When EnableVisualStyles is commented out, the application instead fails with Could not load type 'System.Security.PermissionSet' from assembly 'System.Runtime.Extensions'. #252 has that same issue, although it's a build rather than runtime failure.

ArrowCase avatar Dec 18 '18 16:12 ArrowCase

#249 is fixed.

zsd4yr avatar Dec 18 '18 18:12 zsd4yr

Is this related to https://github.com/dotnet/corefx/pull/33379 ?

zsd4yr avatar Dec 18 '18 18:12 zsd4yr

This is fixed and verified by the latest core sdk

OliaG avatar Dec 18 '18 19:12 OliaG

Yep, this is fixed with 3.0.100-preview-009844.

ArrowCase avatar Dec 18 '18 19:12 ArrowCase