Month: May 2016

Fixed: Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found.

Posted on Updated on

I’m playing around with the Sitecore configurations today, while setting up the content management & content delivery environments. Then suddenly, this error showed up.

Server Error in ‘/’ Application.


Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Sitecore.Exceptions.ConfigurationException: Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ConfigurationException: Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found.]
   Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +272
   Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +131
   Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) +579
   Sitecore.Configuration.Factory.GetIDTable() +27
   Sitecore.Data.IDTables.IDTable.GetProvider() +11
   Sitecore.Data.IDTables.IDTable.GetKeys(String prefix, ID id) +46
   Sitecore.Strategy.Contacts.DataProviders.IDTableHelper.IsItem(String prefix, ID itemId) +73
   Sitecore.Strategy.Contacts.DataProviders.IDTableHelper.IsFacetItem(ID itemId) +65
   Sitecore.Strategy.Contacts.Pipelines.DataProviders.IsHandled.DefaultProcessor.Process(IsHandledArgs args) +327
   (Object , Object[] ) +177
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args) +28
   Sitecore.Strategy.Contacts.Pipelines.DataProviders.GetItemDefinition.CheckIfHandled.Process(GetItemDefinitionArgs args) +217
   (Object , Object[] ) +177
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args) +28
   Sitecore.Strategy.Contacts.DataProviders.ContactFacetDataProvider.GetItemDefinition(ID itemId, CallContext context) +130
   Sitecore.Data.DataProviders.DataProvider.GetItemDefinition(ID itemID, CallContext context, DataProviderCollection providers) +148
   Sitecore.Data.DataSource.GetItemInformation(ID itemID) +88
   Sitecore.Data.DataSource.GetItemData(ID itemID, Language language, Version version) +31
   Sitecore.Nexus.Data.DataCommands.GetItemCommand.GetItem(ID ƒ, Language „, Version , Database ) +92
   Sitecore.Nexus.Data.DataCommands.GetItemCommand.Execute(ID ƒ, Language „, Version , Database ) +496
   Sitecore.Data.Engines.DataCommands.GetItemCommand.DoExecute() +139
   Sitecore.Data.Engines.EngineCommand`2.Execute() +96
   Sitecore.Data.Managers.ItemProvider.GetItem(ID itemId, Language language, Version version, Database database) +292
   Sitecore.Data.Managers.ItemProvider.GetItem(ID itemId, Language language, Version version, Database database, SecurityCheck securityCheck) +141
   Sitecore.ContentTesting.Pipelines.ItemProvider.GetItem.GetItemUnderTestProcessor.Process(GetItemArgs args) +145
   (Object , Object[] ) +74
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Data.Managers.PipelineBasedItemProvider.ExecuteAndReturnResult(String pipelineName, String pipelineDomain, Func`1 pipelineArgsCreator, Func`1 fallbackResult) +64
   Sitecore.Data.Managers.ItemManager.GetItem(String itemPath, Language language, Version version, Database database) +142
   Sitecore.FXM.Matchers.DomainMatcherRepository.GetAllDomainMatchers(IDatabase database) +81
   Sitecore.FXM.Sites.FxmSiteProvider.GetFxmSites() +182
   Sitecore.FXM.Sites.FxmSiteProvider.get_FxmSites() +103
   Sitecore.FXM.Sites.FxmSiteProvider.GetSites() +88
   System.Linq.<SelectManyIterator>d__16`2.MoveNext() +244
   Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites) +138
   Sitecore.Sites.SitecoreSiteProvider.GetSites() +225
   Sitecore.Sites.SiteContextFactory.GetSites() +256
   Sitecore.Sites.SiteContextFactory.GetSiteContext(String hostName, String fullPath, Int32 portNumber) +121
   Sitecore.Pipelines.HttpRequest.SiteResolver.ResolveSiteContext(HttpRequestArgs args) +430
   Sitecore.Pipelines.HttpRequest.SiteResolver.Process(HttpRequestArgs args) +50
   (Object , Object[] ) +74
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Nexus.Web.HttpModule.(Object , EventArgs ) +529
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +92

My first impression was “huh?!, I’m just changing some configurations, so why it’s throwing no matching constructor“. I asked myself.

huh john depp

So I reverted back my changes one by one, and found out that the issue is because of the changes in the Sitecore.Strategy.Contacts.config. Because I replaced the word ‘master‘ to ‘web’ and that’s the reason I encountered the yellow page. Gotcha!

Sitecore.Strategy.Contacts config

If I proceed a little more further, it would be much harder for me to trace the issue, as it seems that the change in the configuration has no direct connection with the stack traces on the first look. So good thing, I am consistently refreshing the SC instance, every time I change something in the configuration.  😉

 

Fixed and Explained: [Sitecore] Forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule

Posted on Updated on

Sitecore - Forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule.png

Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule
To fix this add
<add name=”PerRequestLifestyle” type=”Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor” />
to the <httpModules> section on your web.config.
Windsor also detected you’re running IIS in Integrated Pipeline mode. This means that you also need to add the module to the <modules> section under <system.webServer>.
Alternatively make sure you have Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 assembly in your GAC (it is installed by ASP.NET MVC3 or WebMatrix) and Windsor will be able to register the module automatically without having to add anything to the config file.

Today, I faced a very descriptive error – how I wish all errors are like the one above. It mentioned the root cause, and at the same time the solution. In short, it says it all! 🙂

Actually, there were various posts that answers the same issue.

  1. Using Castle Windsor’s PerWebRequest lifestyle with ASP.NET MVC on IIS7, here
  2. WCF & Castle Windsor – Looks like you forgot, here
  3. Looks like you forgot to register the http module with Windsor Castle with IIS7, here
  4. IIS7 & Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule registering problems, here

Seems pretty straight forward, isn’t? But given that it’s too generic error – we know that – and too straight forward to fix – we know that; I would still try to put an effort to locate it in our Sitecore instance and to discuss it in more details.

In the mean time, let’s fix it first:

  1. Open your web.config file under the \Website root folder
  2. Locate the <system.webServer> group section
  3. Find the <modules runAllManagedModulesForAllRequests=”true”> section
  4. In the bottom part of the module section and before its closing tag </modules>, add the following line
&lt;add name=&quot;PerRequestLifestyle&quot; type=&quot;Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor&quot; /&gt;

Refresh the page, and that should fix the issue.

yes i did it

Even we know how to fix it, at this point, I am still inquisitive on how it was being invoked in our application. I understand that it was called in the Application_startup, but haven’t seen any blog posts that tackles and dive into the code yet – if there’s a blog post on this, you may comment it below, so I can add a reference to it.

Here’s the visual after decompiling the Castle.Windsor.dll – the dependency injection.

Sitecore -Castle Windsor - PerWebRequestLifeStyleModule

Pasting the entire code here, as well.

// Decompiled with JetBrains decompiler
// Type: Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule
// Assembly: Castle.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
// MVID: BE35FEDF-2CA9-427E-91F9-D71A6688B7DC
// Assembly location: D:\Instances\8.0-U3.site.com\Website\bin\Castle.Windsor.dll

using Castle.MicroKernel.Lifestyle.Scoped;
using System;
using System.Text;
using System.Web;

namespace Castle.MicroKernel.Lifestyle
{
  public class PerWebRequestLifestyleModule : IHttpModule
  {
    private const string key = &quot;castle.per-web-request-lifestyle-cache&quot;;
    private static bool initialized;

    public void Dispose()
    {
    }

    public void Init(HttpApplication context)
    {
      PerWebRequestLifestyleModule.initialized = true;
      context.EndRequest += new EventHandler(this.Application_EndRequest);
    }

    protected void Application_EndRequest(object sender, EventArgs e)
    {
      ILifetimeScope scope = PerWebRequestLifestyleModule.GetScope(((HttpApplication) sender).Context, false);
      if (scope == null)
        return;
      scope.Dispose();
    }

    internal static ILifetimeScope GetScope()
    {
      PerWebRequestLifestyleModule.EnsureInitialized();
      HttpContext current = HttpContext.Current;
      if (current == null)
        throw new InvalidOperationException(&quot;HttpContext.Current is null. PerWebRequestLifestyle can only be used in ASP.Net&quot;);
      return PerWebRequestLifestyleModule.GetScope(current, true);
    }

    internal static ILifetimeScope YieldScope()
    {
      HttpContext current = HttpContext.Current;
      if (current == null)
        return (ILifetimeScope) null;
      ILifetimeScope scope = PerWebRequestLifestyleModule.GetScope(current, true);
      if (scope != null)
        current.Items.Remove((object) &quot;castle.per-web-request-lifestyle-cache&quot;);
      return scope;
    }

    private static void EnsureInitialized()
    {
      if (!PerWebRequestLifestyleModule.initialized)
      {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.AppendLine(&quot;Looks like you forgot to register the http module &quot; + typeof (PerWebRequestLifestyleModule).FullName);
        stringBuilder.AppendLine(&quot;To fix this add&quot;);
        stringBuilder.AppendLine(&quot;&amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;add name=\&quot;PerRequestLifestyle\&quot; type=\&quot;Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor\&quot; /&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&quot;);
        stringBuilder.AppendLine(&quot;to the &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;httpModules&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; section on your web.config.&quot;);
        if (HttpRuntime.UsingIntegratedPipeline)
          stringBuilder.AppendLine(&quot;Windsor also detected you're running IIS in Integrated Pipeline mode. This means that you also need to add the module to the &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;modules&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; section under &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;system.webServer&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;.&quot;);
        else
          stringBuilder.AppendLine(&quot;If you plan running on IIS in Integrated Pipeline mode, you also need to add the module to the &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;modules&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; section under &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;system.webServer&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;.&quot;);
        stringBuilder.AppendLine(&quot;Alternatively make sure you have Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 assembly in your GAC (it is installed by ASP.NET MVC3 or WebMatrix) and Windsor will be able to register the module automatically without having to add anything to the config file.&quot;);
        throw new ComponentResolutionException(stringBuilder.ToString());
      }
    }

    private static ILifetimeScope GetScope(HttpContext context, bool createIfNotPresent)
    {
      ILifetimeScope lifetimeScope = (ILifetimeScope) context.Items[(object) &quot;castle.per-web-request-lifestyle-cache&quot;];
      if (lifetimeScope == null &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; createIfNotPresent)
      {
        lifetimeScope = (ILifetimeScope) new DefaultLifetimeScope((IScopeCache) new ScopeCache(), (Action&amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;Burden&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;) null);
        context.Items[(object) &quot;castle.per-web-request-lifestyle-cache&quot;] = (object) lifetimeScope;
      }
      return lifetimeScope;
    }
  }
}

As shown in the above class, the class PerWebRequestLifestyleModule implements a contract / interface (line 14). This System.Web.IHttpModule is responsible for providing the module initialization and disposal events by implementing this interface. In the Init(HttpApplication context) method – line 23, it initializes the modules and prepares it to the handle request.

On the other hand, the line 57 the EnsureInitialized() method is being called in the GetScope() and the GetScope method is referenced by the Application_EndRequest that being referenced by the Init() method. If the initialized property returned FALSE which in our case, not instantiated or registered in the web.config (/configuration/system.webServer/modules) section, then the line 51-71 – the runtime error will be displayed on our page.

The PerWebRequestLifestyleModule  relies on the HttpModule which – perhaps – not initialized on the Application_Start event and Application_EndRequest event in the global.asax when the time the application init is being invoked.

Happy Sitecoring!

Fixed: Value cannot be null, Parameter name: fieldNameTranslator

Posted on Updated on

In this post, I’m going to tackle an error I encountered previously during my upgrade execution to v.8.1 Update-2. There were various discussions over the internet related to this common issue, so if the fix I’m going to provide shortly didn’t resolve your issue, I encourage you to take a look at these blogs / posts, as well.

  1. Getting error on Content Editor after upgrading to Sitecore 8, here
  2. Error in contenttestingupdate.aspx while performing a Sitecore upgrade, here
  3. Content Search rebuild index error, here
  4. Resolved Sitecore SOLR provider error, here

If you have a blog post, that tackles the same issue with different approach / suggestions from the above links, please feel free to comment below so I can add it also in the list.

Value cannot be null Parameter name fieldNametranslator

I faced this issue when configuring SOLR as my search provider in my local instance – migrated from the production instance of one of my clients.

My scenario:

  1. I log-in to Sitecore, and the dashboard page loaded properly
  2. I navigated to Desktop interface, and it loads properly as well.
  3. I navigated to Content Editor, and it throw the above error.

Upon checking on my configurations, I missed to disabled every single file that has ‘Lucene’ on its file name. I did, but it’s still showing the same error.

I compared the DLLs of Content Search and Castle Windsor – in this case my IOC, and they were not assembly identical. So, I replaced all the DLLs from a freshly installed instance – in this case v.8.1 Update-2, but the issue keeps showing.

Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.dll

Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.dll - assembly discrepancy.png

Sitecore.ContentSearch.SolrProvider.dll

Sitecore.ContentSearch.SolrProvider.dll - assembly discrepancy.png

The above were just two (2) out of many file version discrepancies I had encountered.

When you upgrade to a particular Sitecore Platform version, in the Sitecore Experience Platform page (eg. v.8.1 Update-2), there is a SOLR Support package you should use to overwrite the existing assemblies you have in your bin folder.

Sitecore - SORL Support Package dlls

 

Warning: You don’t need all of these DLLs. In my case, I used Castle Windsor as my IOC. So what I only need are:

  1. Castle.Facilities.SolrNetIntegration.dll
  2. Microsoft.Practices.ServiceLocation.dll
  3. Sitecore.ContentSearch.Linq.Solr.dll
  4. Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.dll
  5. Sitecore.ContentSearch.SolrProvider.dll
  6. SolrNet.dll
  7. StructureMap.SolrNetIntegration.dll

The Sitecore Search Scaling Guide is an essential documentation that explained the files you only need in a particular IOC implementation. You can read the chapter 3.3.1, but I would just paste it here to make it more easier for you.

Sitecore Scaling Guide - Selecting the Correct Support DLL files.JPG

Lastly, I altered the Global.asax file.

From: 

Inherits="Sitecore.Web.Application"... 

To:

Inherits="Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorApplication"...

I tried it again, and the Content editor loads properly now.

 

Fixed: Could not load type ‘Sitecore.Forms.Shell.UI.Dialogs.IDEHtmlEditorBase’ from assembly ‘Sitecore.Forms.Core, Version=8.1.0.0’

Posted on Updated on

A couple of weeks ago, I was playing with the upgrade steps of v.8.0 Update-3 to v.8.1 Update -2 of one of my clients. I downloaded the production instance and started the thrill.

One of my agenda was to upgrade the WFFM, and I did it. The form submission was working and I was able to see it in the form reports. However, since I wanted to also check the Save Action > Send Email Message, an unexpected error was popped up. As shown in the picture below.

Sitecore - Could not load type Sitecore.Forms.Shell.UI.Dialogs.IDEHtmlEditorBase

The error is quite descriptive, so I swiftly check the ‘Sitecore.Forms.Core.dll’ to double check if the IDEHtmlEditorBase was there, and truly it is. Secondly, I check the 8.0 version of this DLL and compare it both sides.

Using dotPeek  as a free Decompiler (thanks Jetbrains). I opened the version v.8.0 and v.8.1 of Sitecore.Forms.Core.dll and searched for the IDEHTMLEditorBase

Sitecore.Forms.Core.dll IDEHtmlEditorBase

To completely see what was changed. I copy and pasted both versions to WinMerge, to easily compare the changes.

Sitecore.Forms.Core IdeHtmlEditorBase code change#1

….

Sitecore.Forms.Core IdeHtmlEditorBase code change#2.png

….

Sitecore.Forms.Core IdeHtmlEditorBase code change#3.png

The IDEHtmlEditorBase class didn’t change much ASIDE on this very tiny cosmetic change that intrigued me – the Class casing.

In v.8.0IDEHtmlEditorBase

In v.8.1 : IdeHtmlEditorBase

Moreover, I searched through the entire website to see if there’s a file that uses the IDEHtmlEditorBase (v.8.0), and there is! An override file that is located inside the  \Website\sitecore\shell\Override folder.

Sitecore Send Email override xml file.png

I opened the file, to see how it is being invoked and I found out that there is an associated DLL support patch that uses the old IDEHtmlEditorBase (v.8.0). The WFFM has been upgraded it to v.8.1 Update-2, so the old IDEHtmlEditorBase (v.8.0) is not compatible any longer in Update-2.

Sitecore - SendEmail.xml override file.JPG

I looked inside this file and it was pretty similar to what IdeHtmlEditorBase (v.8.1) does. I also compared the SendEmail.xml of the Override folder to the SendEmail.xml of Action editor folder – the default location: \Website\sitecore\shell\Applications\Modules\Web Forms for Marketers\Dialogs\Action Editor

I renamed both files; The SendEmail.xml of the Override folder and the support patch DLL – Sitecore.Support.402562.dll by using the .disabled.

Afterwards, I did another testing and the Send Email editor dialog box is now loading properly. yes!

Sitecore WFFM - Edit the Send Email message save action

Take away: 

The Sitecore.Support.402562.dll support patch might be helpful to you, so I attached the files in this post; only if the setup of your instance is behind the v.8.1 Update-2 and you want to have the look and feel/functionality of the Send Email of v.8.1 Update-2.

Download zip file here.

 

Sitecore WFFM : Setup Send Email Message Save Action with Form values properly populated

Posted on Updated on

When I was browsing in the Sitecore Community yesterday, I saw this post that – I think – can be further elaborated.

This is actually a common problem with WFFM, if you accidentally didn’t do it right, you will end up having a not-well-formatted email and your customers whom will receive your email will start analyzing jargon words that they didn’t understand at all.

So, let’s setup first your Send Email Message.

Assumptions:

  1. You already have a form, by default it is located here: /sitecore/system/Modules/Web Forms for Marketers/Website/YOUR_FORM
  2. You already set up the fields. In this case, First Name and Last Name

Sitecore WFFM - Location of Form items

Action steps: Create Send Email Message save action

  1. Open the Save Action dialog box by navigating to Forms tab > Form group > Save Action command
  2. In the Actions tab > Save actions dropdown, select the Send Email Message then click add.

Sitecore WFFM - Save Actions dialog box

Next Action steps: Edit the Send Email Message save action

Sitecore WFFM - Edit the Send Email message save action

Followed by populating the form details, as shown below. Then click OK, and click OK again.

Sitecore WFFM - Fill up Send Email Editor

In the above figure, I highlighted the Insert field dropdown because – normally – it led to a problem when typing the [First Name] and [Last Name] manually. Do not ever do that.

Why? If you open the HTML tab, still in the above Send Email editor; You will noticed that it creates an ID attribute for each of the fields you inserted.

Now, let’s try to add the [First Name] and [Last Name] manually. I removed the previous message on this demonstration.

Sitecore WFFM - Insert field via dropdown and manual typing

And open the HTML tab again, and compare the difference.

Sitecore WFFM - Send Email Editor HTML Tab.JPG

Pasting the HTML markup, as well.

Hello [<label id="{9AD96914-B2CC-4D21-B168-839C467F602F}">First Name</label>]&nbsp;[<label id="{45E682DE-CCB1-4AEB-930E-CFCD6617F866}">Last Name</label>] : Via <strong>Insert field</strong>
Hi [First Name] [Last Name]: Via <strong>Manual typing</strong>

You see the difference? 🙂

Let’s try to send it, to totally compare the output of these two actions we did (via Insert field & via manual edit) on the next posts:

  1. Configuring the Send Email Message Parameters
  2. Receiving the Send Email Message by populating the form

Uploading an image via Image field returns broken in SC version 8.1 Initial release and 8.1 Update-1 [short-term & long-term fix]

Posted on Updated on

Last week, I was tapped to troubleshoot a production issue related to image upload via Image field (logo field) of a header item.

The client reported that when they upload an image that has ‘-‘ and spaces around it (eg. main – logo.jpeg), it throws a broken image when viewed in the image upload dialog box.

Figure 1 : Browse a media file

Sitecore Upload an image via Image upload dialog box

Figure 2 : Uploaded

Sitecore image uploaded returns broken image

Figure 3 : Looking at the browser console log, it returned a 404 (not found) error.

Sitecore image uploaded returns 404 in the browser console log.JPG

Figure 4 : Opening the link returns ‘A request document was not found’

Sitecore - Opening an image that has 3 dashes returned an error 404 not found

I really wanted to help, so I made an investigation across all Sitecore platform versions (8.X) to simply check if this was an existing bug and if has a fix already. I also considered checking the latest version of Sitecore (as of this writing, v.8.1-U2) before jumping to a conclusion that it is probably because of a wrong configuration file / DLL or a customization.

I jotted down the result of each of the platform versions, to easily compare where and what version of Sitecore it could be encountered. I used a freshly installed instances for the purpose of my testing.

Platform version, image upload testing result:

  1. 8.0 Update-3 : Working via Media Library & image upload
  2. 8.0 Update-4 : Working via Media Library & image upload
  3. 8.1 Initial release : (current version of the client): NOT working via image upload, but working via Media Library. 
  4. 8.1 Update-1 : NOT working via image upload, but working via Media Library.
  5. 8.1 Update-2 : Working via Media Library & image upload

In a high level explanation:

Say, we have this image file (eg. main – logo.png), when a content user uploads it to Sitecore, the mechanism behind the parsing of this file will be treated like this : mainlogo.jpeg. And therefore,  the error 404 not found was encountered in the browser console log which turns to a broken image upon viewing in the image upload dialog box. Surprisingly, when a client user uploaded an image via Sitecore > Media Library, the image displayed properly. Strange, isn’t it?

In a detailed explanation:

    1. When you upload an image (eg. main – logo.jpeg) via image upload in Sitecore v.8.0 Update-3 and v.8.0 Update-4, it was uploaded properly without any issue.
    2. When you upload an image (eg. main – logo.jpeg) in v.8.1 Initial release (In my case, this is the current version of the client instance) and in v.8.1 Update-1, Sitecore introduces a new – line 1844 in the figure below
      <replace>

      Node under the:

      <encodeNameReplacements>

      That causes the problem. After removing the node <replace>, and test again, the image upload works as expected.

    3. When you upload an image (eg. main – logo.jpeg) via image upload in Sitecore v.8.1 Update-2, you will experience the same working behavior just like the #1 (in v.8.0 Update-3 and v.8.0 Update-4).
      • Looking at the web.config file, the dash ‘-‘ replace node is still exists.
      • And it is still working.

By this time, I suspected that it has something to do with the binaries. So what I did, is to play around with Sitecore.Kernel by replacing the Sitecore.Kernel version of v.8.1 Initial release to v.8. Update 2. I tested it again and it works!

By replacing the Sitecore.Kernel.dll, it fixed the issue without altering any configuration on the freshly installed instances.

I raised my findings to our solution architect by providing a short-term and a long-term fix.

Short-term fix:

Since my personal take is to provide an immediate remedy, considering that the client content users are consistently uploading image and should not be interrupted. So my short-term proposal is to inform the client that every time they upload an image:

  1. They can use the Media library and referenced the image (eg. main – logo.jpeg) to ITEM ABC (eg. header item)
  2. They can use image upload dialog box > upload media file BUT with caution. During the upload, the client content users are forced to change the name of the image if has dash(es) and remove the spaces before and after those dash(es).

From:

Sitecore Upload an image via Image upload dialog box - cropped

To:

Sitecore upload an image via Image upload dialog box with no spaces on and before the dash
Removed the spaces

 

Long-term fix:

  1. Explore upgrading the Client instance to v.8.1 Update-2
  2. Raise to Sitecore, so they can provide a patch on this.  (In progress)
    • I doubled check the known issues page in v.8.1 Initial release up to v.8.1 Update-2, but it seems that this was not yet reported
  3. Dissect the Sitecore.Kernel and provide a custom patch, by checking the assembly and override the mechanism relative to the encodeNameReplacement specific

 

Troubleshooting summary:

  1. Connect with the client
  2. Test client production instance
  3. Test in all platform versions (freshly installed)
    1. via Media Library
    2. via Image upload dialog box
  4. Check release notes and know issues of 8.X
  5. Override the Sitecore.Kernel.dll with the latest version  (v.8.1 Update-2)
  6. Provide a proposals
    1. Short-term fix
    2. Long-term fix

Happy Sitecoring day, everyone!

Reference:

  1. Sample logo image: http://www.logomyway.com/