Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 988921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:42:27+00:00 2026-05-16T05:42:27+00:00

Im using VS2010, C# 4.0, NHibernate and NUnit in a project Im working on..

  • 0

Im using VS2010, C# 4.0, NHibernate and NUnit in a project Im working on.. In doing database tests I’ve come across a wierd problem.. When I run my tests, nunit-agent.exe crashes for no apparent reason.. I’ve since then discovered that when i debug my tests, I get the following exception in the TestFixtureSetup method:

TypeInitializationException: The type
initializer for
‘NHibernate.ByteCode.Castle.ProxyFactory’
threw an exception.
Could not load file or assembly
‘Castle.DynamicProxy2,
Version=2.1.0.0, Culture=neutral,
PublicKeyToken=407dd0808d44fbdc’ or
one of its dependencies. The located
assembly’s manifest definition does
not match the assembly reference.
(Exception from HRESULT:
0x80131040)”:”Castle.DynamicProxy2,
Version=2.1.0.0, Culture=neutral,
PublicKeyToken=407dd0808d44fbdc

Now, it seems to me that what it’s looking for is identical to the one it found?

I’ve doublechecked and the assembly is referenced in the test project.. I have also tried readding the reference, but to no avail.. Any ideas?

UPDATE2: I tried changing the target framework to .net 3.5 of all my projects and now all tests fail with the error above..

UPDATE: Some tests works, others dont.. I have a customer class:

public class Customer : IEntity<string>
{
  private readonly string id;
  public virtual string Id
  {
    get { return id; }
  }

  public virtual string Name { get; set; }
  public virtual Address Address { get; set; }
}

Where the tests runs perfectly fine.. However tests for my product class:

public class Product : IEntity<string>
{
  private readonly string id;

  public virtual string Name { get; set; }
  public virtual decimal Price { get; set; }

  public virtual string Id 
  {
    get { return Id; }
  }
}

Does not work (I get the exception from before).. And the funny thing is that tests for both classes uses the exact same base class that contains all the database access code..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:42:27+00:00Added an answer on May 16, 2026 at 5:42 am

    I solved the problem.. It seems Nhibernate was looking for DynamicProxy 2.1.0 while I had referenced 2.1.1..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.