Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to define security permission set for 0x20000001 #19

Open
OmegaExtern opened this issue Nov 7, 2016 · 8 comments
Open

Failed to define security permission set for 0x20000001 #19

OmegaExtern opened this issue Nov 7, 2016 · 8 comments

Comments

@OmegaExtern
Copy link

OmegaExtern commented Nov 7, 2016

Can't build the program any more, it fails because of this error:

...\packages\DllExport.1.5.0\tools\net.r_eg.DllExport.targets(42,5): error : error : Failed to define security permission set for 0x20000001

I'm running VS2015 with administrator privileges, and I've just upgraded DllExport to v1.5.

@OmegaExtern OmegaExtern changed the title packages\DllExport.1.5.0\tools\net.r_eg.DllExport.targets(42,5): error : error : Failed to define security permission set for 0x20000001 Failed to define security permission set for 0x20000001 Nov 7, 2016
@3F
Copy link
Owner

3F commented Nov 7, 2016

nice

... with administrator privileges

only with ? and what IL Assembler from your settings ? anyway, can you check with both type ? Thanks,

@3F 3F added the bug label Nov 7, 2016
@OmegaExtern
Copy link
Author

only with ?

Well, this is new.
Can you be more specific, what's your question?

what IL Assembler from your settings ?

I have used Direct-Mod...
I don't have time for testing this now, I've expected v1.5 to work just right, and it just disappointed me.

@3F
Copy link
Owner

3F commented Nov 7, 2016

Can you be more specific,

This only when you build with administrator privileges ?

I have used Direct-Mod...

My question about IL Assembler ! 1.5+ now provides also my modified version of coreclr /ILAsm [?]

Look here: #17

    * NEW: Added our custom IL Assembler as option to fix incorrect 0x13 / 0x11 opcodes. #17
           GUI Configurator + MSBuild property: `DllExportOurILAsm`
           It should help for users of Fody projects, etc.
           https://github.com/Fody/Fody/issues/271

           IlAsm 4.5.1 https://github.com/3F/coreclr
           based on 4.5.22220.0 / coreclr 1.0.4
changelog of our coreclr for this release: https://github.com/3F/coreclr/blob/master/changelog.txt

ilasm

<DllExportOurILAsm>true</DllExportOurILAsm>

So, what coreclr version for this problem ?

@3F
Copy link
Owner

3F commented Nov 7, 2016

unfortunately I can't reproduce your problem on v1.5.0.33792 [ ab1c3e6 ]
also with administrator privileges

I need details - how to reproduce your problem ?

You can also attach the build log and project file.

But first, use diagnostic verbosity:

For VS IDE:

  • Tools - Options - Project and Solutions - Build and Run - MSBuild project build verbosity

For msbuild.exe:

  • /v:diag

@3F 3F added the unclear label Nov 7, 2016
@bidolah
Copy link

bidolah commented Dec 26, 2016

  1. Advance Build Setting -> Output ->Debug info set to "none"
  2. DllExportOurILAsm = false
    This steps fix this error. But I need debug my program

@3F
Copy link
Owner

3F commented Dec 26, 2016

@bidolah

I have this error when package "Costura.Fody" https://github.com/Fody/Costura installed.
Advance Build Setting -> Output ->Debug info set to "none"
DllExportOurILAsm = false
This steps fix this error. But I need debug my program

Did I understand correctly that you have Failed to define security permission set for 0x20000001 when you are using Costura.Fody + DllExportOurILAsm = true ?

send me your build log with diagnostic verbosity ( if it's possible ). I will check the Costura.Fody later

see also bug for Fody/ModuleInit - issue #17

@bidolah
Copy link

bidolah commented Dec 26, 2016

@3F
Yes,

Did I understand correctly that you have Failed to define security permission set for 0x20000001 when you are using Costura.Fody + DllExportOurILAsm = true ?

<Costura.Fody + DllExportOurILAsm = true> ==> Failed to define security permission set for 0x20000001

<Costura.Fody + DllExportOurILAsm = false> ==> error : Undeclared identifier IL_0098

Severity Code Description Project File Line Suppression State
Error PRIVATE\AppData\Local\Temp\tmp261F~PRIVATE.il(2297) : error : Undeclared identifier IL_0098
~PRIVATE\Application.cs(69) : error : syntax error at token ':' in: IL_0098: br.s IL_009a PRIVATE packages\DllExport.1.5.1\tools\net.r_eg.DllExport.targets 42

OR(when i delete part of AppDomain.AssemblyResolve Event)

Severity Code Description Project File Line Suppression State
Error ~PRIVATE.il(11601) : error : Undeclared identifier IL_0186
~PRIVATE\ServiceConfiguration.cs(130) : error : syntax error at token ':' in: IL_0186: br.s IL_0188 ~PRIVATE\packages\DllExport.1.5.1\tools\net.r_eg.DllExport.targets 42

Part of building log <Costura.Fody + DllExportOurILAsm = true> ==> Failed to define security permission set for 0x20000001

1> Deleting unused reference to DllExport. (TaskId:63)
1> Parsing 30839 lines of IL took 286 ms. (TaskId:63)
1> calling '"PRIVATE"\packages\DllExport.1.5.1\tools\coreclr\ilasm.exe' with /nologo "/out:"PRIVATE"" ""PRIVATE"\AppData\Local\Temp\tmp5B69"PRIVATE".il" /DLL "/resource="PRIVATE".res" /debug /PE64 /X64 /CVRES="C:\Windows\Microsoft.NET\Framework\v4.0.30319/" (TaskId:63)
1> ilasm '"PRIVATE"\packages\DllExport.1.5.1\tools\coreclr\ilasm.exe' returned gracefully. (TaskId:63)
1>"PRIVATE"\packages\DllExport.1.5.1\tools\net.r_eg.DllExport.targets(42,5): error : error : Failed to define security permission set for 0x20000001
1>"PRIVATE"\packages\DllExport.1.5.1\tools\net.r_eg.DllExport.targets(42,5): error :
1> at RGiesecke.DllExport.Parsing.IlParser.RunIlTool(String installPath, String toolFileName, String requiredPaths, String workingDirectory, String settingsName, String arguments, String toolLoggingCode, String verboseLoggingCode, IDllExportNotifier notifier, Int32 timeout, Func2 suppressErrorOutputLine) in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport\Parsing\IlParser.cs:line 378 1> at RGiesecke.DllExport.Parsing.IlAsm.RunCore(CpuPlatform cpu, String fileName, String ressourceParam, String ilSuffix) in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport\Parsing\ILAsm.cs:line 148 1> at RGiesecke.DllExport.Parsing.IlAsm.Run(String outputFile, String ilSuffix, CpuPlatform cpu) in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport\Parsing\ILAsm.cs:line 118 1> at RGiesecke.DllExport.Parsing.IlAsm.ReassembleFile(String outputFile, String ilSuffix, CpuPlatform cpu) in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport\Parsing\ILAsm.cs:line 80 1> at RGiesecke.DllExport.DllExportWeaver.reassembleFile(IlAsm ilAsm, String outputFile, String ilSuffix, CpuPlatform cpu) in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport\DllExportWeaver.cs:line 196 1> at RGiesecke.DllExport.DllExportWeaver.RunIlAsm(IlAsm ilAsm) in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport\DllExportWeaver.cs:line 147 1> at RGiesecke.DllExport.DllExportWeaver.Run() in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport\DllExportWeaver.cs:line 87 1> at RGiesecke.DllExport.MSBuild.ExportTaskImplementation1.Execute() in D:\prg\projects\DllExport\DllExport\RGiesecke.DllExport.MSBuild\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 437 (TaskId:63)
1>Done executing task "DllExportAppDomainIsolatedTask" -- FAILED. (TaskId:63)
1>Done building target "DllExportMod" in project "PRIVATE" -- FAILED.: (TargetId:101)

Example:
[DllExport("about", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)]

@3F
Copy link
Owner

3F commented Dec 26, 2016

Thanks for details !

Now it reproduced for me when I use the SecurityPermission.

error : Failed to define security permission set for ...

0x02000004

For something like this:

[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
internal class ClassA
{ }

your 0x20000001

For something like this:

[assembly: SecurityPermission(SecurityAction.RequestMinimum)] 

So, our bug from Assembler::EmitSecurityInfo

but mainly, the open ilasm on CoreCLR has a lot of restrictions :( like this, or this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants