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 6350479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:49:05+00:00 2026-05-24T21:49:05+00:00

My proxy generator is having trouble generating proxies for internal mapped Nhibernate classes. I

  • 0

My proxy generator is having trouble generating proxies for internal mapped Nhibernate classes. I have tried adding them as visible using InternalsVisibleTo in assemblyinfo.cs but it doesn’t seem to work. Worse, I don’t know how to tell if I’ve even successfully managed to friend the proxy assemblies I want to because if I change a few numbers in the proxy assemblies public key in assemblyinfo.cs there is no error thrown.

Error:

Test method TestProject1.UnitTest1.TestMethod1 threw exception:
NHibernate.HibernateException: Creating a proxy instance failed —> Castle.DynamicProxy.Generators.GeneratorException: Type is not public, so a proxy cannot be generated. Type: BaseSystemCore.Domain.Lot

StackTrace:

Castle.DynamicProxy.DefaultProxyBuilder.AssertValidType(Type target)
Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options)
Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors)
NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id, ISessionImplementor session)
NHibernateUtilities.BaseUnitOfWork.handleException(Exception e) in C:\Users\Isaac.G\Desktop\svn.bolinger.ca\Library Projects\NHibernateUtilities\NHibernateUtilities\BaseUnitOfWork.cs: line 871
NHibernateUtilities.BaseUnitOfWork.getAllT in C:\Users\Isaac.G\Desktop\svn.bolinger.ca\Library Projects\NHibernateUtilities\NHibernateUtilities\BaseUnitOfWork.cs: line 115
TestProject1.UnitTest1.TestMethod1() in C:\Users\Isaac.G\Desktop\svn.bolinger.ca\Library Projects\BaseSystemCore\TestProject1\UnitTest1.cs: line 71

Has anyone ever got this to work before?

Thanks

Isaac

  • 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-24T21:49:05+00:00Added an answer on May 24, 2026 at 9:49 pm

    NHibernate 3.2 has built in proxy provider. I briefly look at the sources at it seems like they use this format: {0}ProxyAssembly. Where {0} is a type name for lazy mapped class. I have not tested it though. Try adding following to your AssemblyInfo.cs and replace {0} with your lazy class name:

    [assembly: InternalsVisibleTo("{0}ProxyAssembly")]
    

    If you still want to use older version of NHibernate you can try using this (for castle byte code provider):

    [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
    

    DynamicProxyGenAssembly2 is a temporary assembly that gets generated on the fly by Castle. It contains classes derived from your mapped classes (proxies).

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

Sidebar

Related Questions

Is it possible to have the proxy classes that are generated when setting a
I have three classes mapped using the table-per-subclass class mapping strategy. The tables are:
I have exported a COM+ application proxy, which generates MSI and CAB files, and
Our proxy went down and I tried to update dependencies with Maven while it
I am trying to test the use-case of a customer having a proxy with
I have a number of WCF services on my internal network which are hosted
Progress Version: 10.0B05.32 A few years ago, we used the Progress Proxy Generator to
It seems that there are two methods for auto generating web service proxies in
A task at university was to implement a simple proxy generator / interceptor mechanism
I'm talking with a web service with a generated proxy that uses System.Web.Services.Protocols.SoapHttpClientProtocol ,

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.