Sitecore instance needs DLL from other project…?

Alright guys and gals, this one is really weird: when rebuilding the Lucene indexes for my Web database, my Sitecore instance (6.4.1) is taking a dirt nap. Looking at log files, everything is peachy until the index rebuild starts, and then the log is filled with MEGABYTES of the following stack trace repeated over and over:

ManagedPoolThread #6 15:57:06 ERROR Failed to sort items
Exception: System.IO.FileNotFoundException
Message: Could not load file or assembly 'file:///[OTHER PROJECT LIBRARY].dll' or one of its dependencies. The system cannot find the file specified.
Source: mscorlib
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
    at System.Reflection.Assembly.LoadFrom(String assemblyFile)
    at Sitecore.Reflection.ReflectionUtil.LoadAssembly(String name)
    at Sitecore.Reflection.ReflectionUtil.CreateObject(String assembly, String className, Object[] parameters)
    at Sitecore.Reflection.ReflectionUtil.CreateObject(String typeName, Object[] parameters)
    at Sitecore.Data.Comparers.ComparerFactory.GetComparer(String sortingId, Database database)
    at Sitecore.Data.Comparers.ComparerFactory.GetComparer(Item item)
    at Sitecore.Configuration.Factory.GetItemComparer(Item item)
    at Sitecore.Data.Managers.ItemProvider.Sort(ItemList items, Item owner)

(the [OTHER PROJECT LIBRARY].dll was shortened for privacy, but it's a full path to this project's sitecore/website/bin directory)

The really, really weird thing is that this DLL isn't referenced in any way, shape, or form in both the solution or the entire filetree (both the project and website folders).

But here's the punchline: this DLL isn't even from the same project, it's from a different project I have on my workstation (which is running in its own Sitecore instance alongside this project).

How could this happen? Project A is trying to reference a DLL from Project B, and this DLL isn't referenced in any way. I've even checked the EventQueue tables in my databases... I'm really starting to lose my mind here.

Answers


Looking at the attached stacktrace you can see that the problem is that Sitecore tries to find a proper comparer while sorting some items. It looks like one of your items has the "Type" field set to the class name from some external library. Maybe someone pasted some wrong class name from the clipboard and hasn't noticed it?

Try to execute this query to find the name and the id of the Item with wrong field value set and the value of field:

SELECT 
    ii.Name, ii.ID, f.Value 
FROM 
    [Sitecore_Master].[dbo].[SharedFields] f,
    [Sitecore_Master].[dbo].[Items] i,
    [Sitecore_Web].[dbo].[Items] ii
WHERE f.FieldId = i.ID 
    AND i.Name = 'Type'
    AND ii.ID = f.ItemId
    AND f.Value LIKE '%[OTHER ASSSEMBLY NAME WITHOUT DLL].%'

Change the name of the database to your database and use the name of the assembly that appears in the logs. You can also try this query with other databases and without AND i.Name = 'Type' line.

The other way is to override the ItemProvider class as follows:

namespace My.Namespace
{
    public class MyItemProvider : Sitecore.Data.Managers.ItemProvider
    {
        protected override void Sort(Sitecore.Collections.ItemList items, Sitecore.Data.Items.Item owner)
        {
            try
            {
                base.Sort(items, owner);
            }
            catch (System.Exception exc)
            {
                Sitecore.Diagnostics.Log.Error("Exception while sorting children of " + owner.Paths.FullPath, exc, this);
            }
        }
    }
}

and change in your sitecore.config file:

<itemManager defaultProvider="default">
    <providers>
        <clear/>
        <add name="default" type="My.Namespace.MyItemProvider, My.Assembly"/>
    </providers>
</itemManager>

You should now see in logs which item is causing problems.


Look through your config files to see if you can find a reference to this mysterious DLL.

Tip: browse to /sitecore/admin/showconfig.aspx to see the complete config settings from the main web.config plus all the include config files. My hunch is that there is some custom handler referencing the DLL which is fired after your index rebuild


Need Your Help

How to update a drawn rectangle with new values in java

java paint

I have made an extremely simple Pokémon battle simulator and I am starting to upgrade it. By upgrade it, I mean that in a very minimalistic way ( at least in my mind ). This upgrade consists of cre...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.