Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

EPiServer.Find.Commerce Type Load Error on Startup With Version 10.1.1

Vote:
 

I'm attempting to update a project to the latest nuget packages, and am getting a "could not load type" error with version 10.1.1 of EPiServer.Find.Commerce.  The specific error is coming from FindCommericeInitializationModule when it tries to call "ApplyConventions."  Exception message is as follows:

"Could not load type 'Microsoft.Extensions.Logging.ILogValues' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.":"Microsoft.Extensions.Logging.ILogValues"


I decompiled Microsoft.Extensions.Logging.Abstractions, and that version does not contain a definition for ILogValues.  Downgrading EPiServer.Find.Commerce back to version 10.1.0 fixes the error.  The release notes for this version of the nuget package list the only bugfix as something related to initialization.

#187940
Edited, Feb 07, 2018 0:09
Vote:
 

That's strange. The bug fix does not change the logging at all - it's been that way from previous version. Sounds more like a log configuration issue to me. How does your Episerverlog.config look like?

#187943
Feb 07, 2018 7:28
Vote:
 

EPiServerLog.config looks normal to me:

<?xml version="1.0" encoding="utf-8"?>
<log4net>
    <appender name="errorFileLogAppender" type="log4net.Appender.RollingFileAppender" >
        <!-- Consider moving the log files to a location outside the web application -->
        <file value="App_Data\EPiServerErrors.log" />
        <encoding value="utf-8" />
        <staticLogFileName value="true"/>
        <datePattern value=".yyyyMMdd.'log'" />
        <rollingStyle value="Date" />
        <threshold value="Error" />
        <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
        <appendToFile value="true" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date [%thread] %level %logger: %message%n" />
        </layout>
    </appender>
    <appender name="outputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender" >
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="[%thread] %level %logger: %message%n" />
        </layout>
    </appender>
 
    <!-- Reduce amount of debug logging -->
    <logger name="EPiServer.Core.OptimisticCache" additivity="false">
        <level value="Error" />
    </logger>
    <logger name="EPiServer.Core.ContentProvider" additivity="false">
        <level value="Error" />
    </logger>
    <logger name="EPiServer.Data.Dynamic.Providers.DbDataStoreProvider" additivity="false">
        <level value="Error" />
    </logger>
    <logger name="EPiServer.Data.Providers.SqlDatabaseHandler" additivity="false">
        <level value="Error" />
    </logger>
    <logger name="EPiServer.Data.Providers.ConnectionContext" additivity="false">
        <level value="Error" />
    </logger>
 
    <root>
        <!--Be careful, setting this value to All, Debug or Info will affect performance.-->
        <level value="Error" />
 
        <!--Enabled file logging-->
        <appender-ref ref="errorFileLogAppender" />
 
        <!-- Use DebugView (Microsoft/SysInternals) and enable Capture Win32 + Capture Global Win32 (http://technet.microsoft.com/en-us/sysinternals/bb896647). -->
        <!--appender-ref ref="outputDebugStringAppender" /-->
    </root>
</log4net>
#187970
Edited, Feb 07, 2018 16:26
Vote:
 
<p>Do you have some other configuration which uses&nbsp;<span class="hljs-string">Microsoft.Extensions.Logging.Abstractions? It sounds like there was a problem with package dependencies and the package was automatically updated?&nbsp;</span></p>
#187971
Feb 07, 2018 16:37
Vote:
 

There is no other use of that package that I'm aware of.  What version of that pacakge is supported?  I just tried downgrading to 1.1.2 and am getting the same error when it tries to load ILogValues from that version.

#187972
Feb 07, 2018 16:59
Vote:
 

So, my issues do appear to be due to a newer version of that package than what the Epi DLLs are expecting.  However, shouldn't the Epi nuget package dependencies prevent me from installing too new of a version of a given package?

For example, I had v2.0.0 of Microsoft.Extensions.Logging.Abstractions installed, and that version does indeed not contain a definition for ILogValues, which explains the errors I was seeing.  By manually downgrading that pacakge and decompiling, I learned that v1.0.0 does not contain ILogValues either.  Some searching on github revealed that ILogValues did exist at some point, so I went even further back than v1.0.0.  After clicking "include prerelease" for nuget, I tried v1.0.0-rc2, and then eventually v1.0.0-rc1 where I finally found a DLL that contains ILogValues.  So, not only does the latest major version of Microsoft.Extensions.Logging.Abstractions (v2.0.0) break things, so does the initial release (v1.0.0).  You need to go all the way back to the first release candidate -- this does not seem very intuitive, and as far as I can tell, is not documented anywhere.

On a related note, in my log, I have several similar type load errors coming from Epi Forms, which I'm guessing are similar issues to what I experienced with Microsoft.Extensions.Logging.Abstractions.

Is there a reason that Epi's nuget pacakge dependencies are not set up in a way that they prevent installing incompatible versions?  Is there a way to prevent inadvertently upgrading to an incompatible version?

Edit:  It looks like some of these issues are because the Microsoft pacakages have poorly defined dependencies.  This github issue sheds a little light on things.  It definitely doesn't look like I'm the only one that has wasted time on this either.  I'm thikning whatever changes happened in v10.1.1 of Episerver.Find.Commerce just made the issue more apparent.

#187977
Edited, Feb 07, 2018 18:33
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.