revision 388: Iesi.Collections dll mismatch

383 views
Skip to first unread message

Alexander Popov

unread,
Mar 10, 2009, 7:08:27 PM3/10/09
to S#arp Architecture
got source from svn, but have error on start:

======================
Could not load file or assembly 'Iesi.Collections, Version=1.0.0.3,
Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
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: System.IO.FileLoadException: Could not load file or
assembly 'Iesi.Collections, Version=1.0.0.3, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)

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.

Assembly Load Trace: The following information can be helpful to
determine why the assembly 'Iesi.Collections, Version=1.0.0.3,
Culture=neutral, PublicKeyToken=aa95f207798dfdb4' could not be loaded.


=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = Iesi.Collections, Version=1.0.0.3, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4
(Fully-specified)
LOG: Appbase = file:///D:/work/Alexander/Zawerty/Zawerty.Web/
LOG: Initial PrivatePath = D:\work\Alexander\Zawerty\Zawerty.Web\bin
Calling assembly : NHibernate, Version=2.0.1.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\work\Alexander\Zawerty
\Zawerty.Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework
\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET
\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Iesi.Collections, Version=1.0.0.3,
Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/zawertyweb/17df6268/944dc247/Iesi.Collections.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/zawertyweb/17df6268/944dc247/Iesi.Collections/
Iesi.Collections.DLL.
LOG: Attempting download of new URL
file:///D:/work/Alexander/Zawerty/Zawerty.Web/bin/Iesi.Collections.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision
Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing
terminated.
==============

In Bin folder nHibernate refers on Iesi collections 1.0.0.3, but
really there is version 1.0.1.0



Billy

unread,
Mar 10, 2009, 7:19:17 PM3/10/09
to S#arp Architecture
Hi Alexander,

I assume you got latest and then added the DLLs to your existing
project? You'll need to add the following assembly redirect to
YourProject.Web/web.config and YourProject.Tests/app.config:

<dependentAssembly>
<assemblyIdentity name="Iesi.Collections"
publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535"
newVersion="1.0.1.0"/>
</dependentAssembly>

This will fix it for you. (This is also listed in the upgrade steps
in /trunk/VersionHistory.txt along with other things to watch out
for.)

Billy

mogadanez

unread,
Mar 10, 2009, 8:07:45 PM3/10/09
to S#arp Architecture
it's work.
but gave another problem - NullReference Exception on start:

=============
Object reference not set to an instance of an object.
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: System.NullReferenceException: Object reference not
set to an instance of an object.

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:


[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.PipelineStepManager.ResumeSteps(Exception error) +1091
System.Web.HttpApplication.BeginProcessRequestNotification
(HttpContext context, AsyncCallback cb) +91
System.Web.HttpRuntime.ProcessRequestNotificationPrivate
(IIS7WorkerRequest wr, HttpContext context) +508

======================

reproduced Both on My project and Nortwind sample

Billy

unread,
Mar 10, 2009, 8:28:33 PM3/10/09
to S#arp Architecture
I believe this is due to a bug that was found yesterday and resolved
this morning, discussed at
http://groups.google.com/group/sharp-architecture/browse_thread/thread/a520dd74e55f8d73?hl=en

The Init() method on
http://sharp-architecture.googlecode.com/svn/trunk/src/NorthwindSample/app/Northwind.Web/Global.asax.cs
demonstrates the resolution.

Billy

mogadanez

unread,
Mar 10, 2009, 8:34:15 PM3/10/09
to S#arp Architecture
i have revision with this changes, and it crash anyway. but seems
that same problem - i was switch Application in IIS to classic mode -
and all works fine.
now is too late here - will take a look tomorrow on it.

On Mar 11, 3:28 am, Billy <wmccaffe...@gmail.com> wrote:
> I believe this is due to a bug that was found yesterday and resolved
> this morning, discussed athttp://groups.google.com/group/sharp-architecture/browse_thread/threa...
>
> The Init() method onhttp://sharp-architecture.googlecode.com/svn/trunk/src/NorthwindSampl...

Billy

unread,
Mar 10, 2009, 10:33:07 PM3/10/09
to S#arp Architecture
Sorry, I had assumed you were already running in classic mode per the
documentation section entitled "Configuring IIS 7 for ASP.NET MVC."
Personally, I do not have recommendations for running S#arp
Architecture outside of classic mode and do not have plans to try to
resolve this. But if someone would be interested in taking up this
challenge, that person would be most welcome to give it a try.

Billy

mogadanez

unread,
Mar 11, 2009, 3:44:19 AM3/11/09
to S#arp Architecture
For me integrated Mode is not an end in itself. but just a way to
easy get and run project on any machine without nay additional setups.
So i will try to fix it, did you now a direction where it can be
broken?
another interesting thing is that before sync to last revision it was
worked on Integrated mode.

Simone Busoli

unread,
Mar 11, 2009, 4:05:47 AM3/11/09
to sharp-arc...@googlegroups.com
Wasn't the change you committed yesterday supposed to fix this issue?

Billy

unread,
Mar 11, 2009, 9:38:06 AM3/11/09
to S#arp Architecture
Yesterday's fix wasn't specifically to support integrated mode on IIS
7; but another IIS 7 issue we were running into when the NHibernate
initialization was moved from Global.Init() to Application_Start().
I've opened an issue concerning the support of integrated mode on IIS
7 at http://code.google.com/p/sharp-architecture/issues/detail?id=75.
I do not intend spending much time on this lower priority issue
myself, but I'll keep an eye on the issue if someone cares to look
into it further.

Billy


On Mar 11, 2:05 am, Simone Busoli <simone.bus...@gmail.com> wrote:
> Wasn't the change you committed yesterday supposed to fix this issue?
>

Simone Busoli

unread,
Mar 11, 2009, 1:23:17 PM3/11/09
to sharp-arc...@googlegroups.com
I don't have much time to test it, can anyone provide a little more detail about what exception is thrown so that it's easier to identify the cause?

Marti

unread,
Mar 15, 2009, 6:56:52 PM3/15/09
to S#arp Architecture
I posted a reply to the issue: http://code.google.com/p/sharp-architecture/issues/detail?id=75#c2
I don't know how reliable my solution is, but at least we know where
the issue is now. I prefer using Integrated Mode, so I'll be testing
this change in the coming days.

Marti

On Mar 11, 3:38 pm, Billy <wmccaffe...@gmail.com> wrote:
> Yesterday's fix wasn't specifically to support integrated mode on IIS
> 7; but another IIS 7 issue we were running into when the NHibernate
> initialization was moved from Global.Init() to Application_Start().
> I've opened an issue concerning the support of integrated mode on IIS
> 7 athttp://code.google.com/p/sharp-architecture/issues/detail?id=75.

Kyle Baley

unread,
Apr 3, 2009, 2:24:03 PM4/3/09
to sharp-arc...@googlegroups.com
I'm dragging this out because I was running into pipeline issues as well. I have a fix which I can't claim credit for. But by the same token, I have no idea if it's the right way of doing things so I'll refrain from assigning blame/credit until it's been discussed:

        public override void Init()
        {
            base.Init();
            NHibernateInitializer.Instance().NHibernateSessionIsLoaded = false;
            webSessionStorage = new WebSessionStorage(this);

        }

        protected void Application_BeginRequest(object sender, EventArgs e) {

            NHibernateInitializer.Instance().InitializeNHibernate(() =>
                NHibernateSession.Init(webSessionStorage,
                    new[] { Server.MapPath("~/bin/BookedIn.Data.dll") },
                    new AutoPersistenceModelGenerator().Generate(),
                    Server.MapPath("~/bin/NHibernate.config")));

        }
        private WebSessionStorage webSessionStorage;


This references another class, NHibernateInitializer, which is here:

    public class NHibernateInitializer
    {
        private static readonly object syncLock = new object( );
        private static NHibernateInitializer _instance;

        protected NHibernateInitializer( )
        {
        }

        public bool NHibernateSessionIsLoaded { get; set; }

        public static NHibernateInitializer Instance( )
        {
            if ( _instance == null )
            {
                lock ( syncLock )
                {
                    if ( _instance == null )
                    {
                        _instance = new NHibernateInitializer( );
                    }
                }
            }

            return _instance;
        }

        public void InitializeNHibernate( Action initMethod )
        {
            lock ( syncLock )
            {
                if ( !NHibernateSessionIsLoaded )
                {
                    initMethod( );
                    NHibernateSessionIsLoaded = true;
                }
            }
        }
    }


This got rid of the pipeline issues but threading and NHibernate session initialization aren't my forte. It works for me in integrated mode so I'm leaving it to the experts to decide if it's correct.

Mark Perry

unread,
Apr 29, 2009, 12:09:30 PM4/29/09
to S#arp Architecture
Any update on this and the issue posted here:
http://code.google.com/p/sharp-architecture/issues/detail?id=75

BTW the Northwind sample currently does not run in Integrated Pipeline
Mode on my Vista 64 box.

Is the fix posted above more suitable than the one posted under the
Issue 75?

Thanks, Mark
> ...
>
> read more »

Billy

unread,
May 2, 2009, 4:59:54 AM5/2/09
to S#arp Architecture
Kyle,

Why are you putting it in Application_BeginRequest...does it still
bomb in Init(), even with the extraction of the initialization code
into a singleton?

Billy
> ...
>
> read more »

Billy

unread,
May 2, 2009, 11:47:03 AM5/2/09
to S#arp Architecture
Please disregard that question. Here's the final solution I've
included which is now checked into the trunk (note that the VS project
template has not yet been updated to reflect this or support for
multiple DBs yet):

* Added SharpArch.Data.NHibernate.NHibernateInitializer
* Invoking it in Global.asax.cs as follows (allows for initialization
of multiple databases as well):

protected void Application_BeginRequest(object sender, EventArgs e) {
NHibernateInitializer.Instance().InitializeNHibernateOnce(
() => InitializeNHibernateSession());
}

/// <summary>
/// If you need to communicate to multiple databases, you'd add a line
to this method to
/// initialize the other database as well.
/// </summary>
private void InitializeNHibernateSession() {
NHibernateSession.Init(
new WebSessionStorage(this),
new string[] { Server.MapPath("~/bin/Northwind.Data.dll") },
new AutoPersistenceModelGenerator().Generate(),
Server.MapPath("~/NHibernate.config"));
}

Billy
> ...
>
> read more »

indomitablehef

unread,
May 3, 2009, 11:42:22 AM5/3/09
to S#arp Architecture
There's an issue with that...if you try to do "new WebSessionStorage
(this)" when calling this from Begin_Request, you get the following
error:

Event handlers can only be bound to HttpApplication events during
IHttpModule initialization.

So, you can do this instead:

private WebSessionStorage webSessionStorage;

public override void Init() {
base.Init();
webSessionStorage = new WebSessionStorage(this);
}

protected void Application_BeginRequest(object sender,
EventArgs e) {
NHibernateInitializer.Instance().InitializeNHibernateOnce(
() => InitializeNHibernateSession());

}
private void InitializeNHibernateSession() {
NHibernateSession.Init(
webSessionStorage,
new string[] { Server.MapPath("~/bin/
> ...
>
> read more »

Billy

unread,
May 3, 2009, 12:37:43 PM5/3/09
to S#arp Architecture
Thanks indomitablehef! I've checked in the fix to Global.asax.cs,
accordingly.

Billy
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages