signing Microsoft.Dynamic.dll

Dec 1, 2009 at 1:39 AM

I have an app that uses Microsoft.Dynamic.dll. It needs to run from the network, so it has to be signed (unless there is someway to turn this off). I downloaded the source from codeplex, signed everything that Microsoft.Dynamic depends on and built it all.

I then referenced Microsoft.Dynamic.dll in my app. At run time when I try and use anything in Microsoft.Dynamic.dll I get a strong name validation failed issue.

From what I can tell Microsoft.Dynamic depends only on Microsoft.Scripting, and Microsoft.Scripting can be build with only references from the GAC. Both of the mentioned dlls are signed. Only Microsoft.Dynamic is referenced.

Is this possible to do, or am I doing something wrong? I've done this sort of thing numerous times, but never had this issue.

 

thanks for any future help

Dec 1, 2009 at 2:26 AM

As a side note, I have tried commenting out

[assembly: SecurityTransparent]

and changing the SecurityRuleSet to 2, like so:

[assembly: SecurityRules(SecurityRuleSet.Level2)]

 

I have also tried different combinations of getting ride of conditional compilation symbols. These are listed for Microsoft.Dynamic:

CODEPLEX_40;CLR4;SYSTEM_CORE

 

At this point I feel like I'm trying random things hoping something works. I'm sure this is an easy fix - I'm just missing it.

 

In case anyone is interested, this is how you can reproduce this issue:

1. Create a solution with Microsoft.Dynamic.Build and Microsoft.Scripting.Build.

2. Fix the broken references that are in their by default. Microsoft.Scripting should only have 4.0 references, and Dynamic will have 4.0 references with a reference to Scripting.

3. Create a project that references Dynamic, and use something in there, like this: System.Linq.Expressions.Expression e = Microsoft.Scripting.Ast.Utils.Convert(
                System.Linq.Expressions.Expression.Constant(0L),
                typeof(long));

4. At this point you will be able to run this code.

5. Sign the 3 projects that are now in your solution.

6. Run the code and get this exception:

System.IO.FileLoadException was unhandled
  Message=Could not load file or assembly 'Microsoft.Dynamic, Version=0.9.6.20, Culture=neutral, PublicKeyToken=2d8c82d3a1452ef1' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
  Source=UsesDynamic
  FileName=Microsoft.Dynamic, Version=0.9.6.20, Culture=neutral, PublicKeyToken=2d8c82d3a1452ef1
  FusionLog=""
  StackTrace:
       at UsesDynamic.Program.Main()
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Security.SecurityException
       Message=Strong name validation failed. (Exception from HRESULT: 0x8013141A)
       InnerException:

 

thanks

Dec 1, 2009 at 2:31 AM
If you can use a prebuilt binary, the IronRuby 1.0 RC1 was released last week and it contains your assemblies already signed.

You can download it from http://ironruby.codeplex.com.

JD

Sent from my HTC


From: CodeMoniker <notifications@codeplex.com>
Sent: Monday, November 30, 2009 6:27 PM
To: Jim Deville <jdeville@microsoft.com>
Subject: Re: signing Microsoft.Dynamic.dll [dlr:76642]

From: CodeMoniker

As a side note, I have tried commenting out

[assembly: SecurityTransparent]

and changing the SecurityRuleSet to 2, like so:

[assembly: SecurityRules(SecurityRuleSet.Level2)]

I have also tried different combinations of getting ride of conditional compilation symbols. These are listed for Microsoft.Dynamic:

CODEPLEX_40;CLR4;SYSTEM_CORE

At this point I feel like I'm trying random things hoping something works. I'm sure this is an easy fix - I'm just missing it.

In case anyone is interested, this is how you can reproduce this issue:

1. Create a solution with Microsoft.Dynamic.Build and Microsoft.Scripting.Build.

2. Fix the broken references that are in their by default. Microsoft.Scripting should only have 4.0 references, and Dynamic will have 4.0 references with a reference to Scripting.

3. Create a project that references Dynamic, and use something in there, like this: System.Linq.Expressions.Expression e = Microsoft.Scripting.Ast.Utils.Convert(
System.Linq.Expressions.Expression.Constant(0L),
typeof(long));

4. At this point you will be able to run this code.

5. Sign the 3 projects that are now in your solution.

6. Run the code and get this exception:

System.IO.FileLoadException was unhandled
Message=Could not load file or assembly 'Microsoft.Dynamic, Version=0.9.6.20, Culture=neutral, PublicKeyToken=2d8c82d3a1452ef1' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
Source=UsesDynamic
FileName=Microsoft.Dynamic, Version=0.9.6.20, Culture=neutral, PublicKeyToken=2d8c82d3a1452ef1
FusionLog=""
StackTrace:
at UsesDynamic.Program.Main()
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Security.SecurityException
Message=Strong name validation failed. (Exception from HRESULT: 0x8013141A)
InnerException:

thanks