Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are signed assemblies slow to load?

I encountered a strange problem this week that I can't explain: I switched my application to use the signed version of some third party assemblies (Xceed Grid and some of their other components) and the application start time went into the toilet. Each time the application loaded a signed assembly, it took 30 seconds to load. Application start went from 5 seconds to over 90 seconds. What the heck is going on here?!

Some other info:

  • This is a WinForms app running under .NET 3.5 SP1.
  • The computer had no internet connection (on purpose, for security).
like image 747
Mike Post Avatar asked Oct 24 '09 17:10

Mike Post


2 Answers

Jason Evans' post does contain the answer, but in the form of a link. I thought it would be good to post the actual solution here:

Create a file Appname.exe.config in the same folder as the executable (where Appname is the name of your executable; for development, this would be in the debug output folder). This shows an xml file that assumes you don't have other entries in the main config file; if you have the file already, I assume you would just add the new sections/text as necessary:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
        <generatePublisherEvidence enabled="false" />
    </runtime>
</configuration>
like image 154
MartinKB Avatar answered Oct 01 '22 16:10

MartinKB


Have a look at these links:

  • http://blogs.technet.com/markrussinovich/archive/2009/05/26/3244913.aspx
  • http://blogs.msdn.com/tess/archive/2008/05/13/asp-net-hang-authenticode-signed-assemblies.aspx

They might help. It could be that the config on your system means that the .NET framework is doing a lot of extra work to verify the assembly. If this is the case, then you can configure it to not be so picky.

like image 43
Jason Evans Avatar answered Oct 01 '22 15:10

Jason Evans