[corlib] Ensure FileIOPermission ctor is not called on mobile
commit5e6fdbd71d06cff711e4d734321185e6872f1733
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Sun, 4 Sep 2016 14:42:11 +0000 (4 16:42 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 6 Sep 2016 10:27:26 +0000 (6 12:27 +0200)
tree41848fa60718e9412571cfea3d7090c8018264d8
parentd06a5075a884472f62739aa571dad983d89cb45b
[corlib] Ensure FileIOPermission ctor is not called on mobile

After https://github.com/mono/mono/pull/3452 was merged, the LinkSdkRegressionTest.SecurityDeclaration
test in XI started failing:

```
[FAIL] LinkSdkRegressionTest.SecurityDeclaration :   FileIOPermissionAccess
  Expected: null
  But was:  <System.Security.Permissions.FileIOPermissionAccess>

  at LinkSdk.LinkSdkRegressionTest.SecurityDeclaration () [0x00033] in /Users/builder/data/lanes/1411/2a96404f/source/xamarin-macios/tests/linker-ios/link sdk/LinkSdkRegressionTest.cs:990
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /Users/builder/data/lanes/1411/2a96404f/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
```

Due to the added call in the PR the linker preserved FileIOPermissionAccess enum,
which is apparently something we want to avoid.

Since according to https://github.com/mono/mono/pull/3452#discussion_r76384945 the only point of calling the
FileIOPermission is validating that the path doesn't contain invalid characters (mostly an issue on Windows),
I decided to just copy those checks as it's way cleaner.
mcs/class/corlib/System/AppDomainSetup.cs