Вопрос

I would like to profile my NHibernate queries that I run from LINQPad using NHibernate Profiler.

When I try to initialize the profiler using this:

NHibernateProfiler.Initialize();

I get the following error:

The type or namespace name 'NHibernate' does not exist in the namespace 'HibernatingRhinos.Profiler.Appender' (are you missing an assembly reference?)

This strange because without initializing the profiler my NHibernate code in LINQPad executes as expected (therefore definitely finding the required NHibernate DLLs).

LINQPad is configured as follows:

Additional references:

  • NHibernate.dll (3.2.0.4000)
  • HibernatingRhinos.Profiler.Appender.v4.0.dll (1.0.0.920)
  • ConformOrm.dll (2.0.0.0)
  • ConformOrm.Shop.dll (2.0.0.0)
  • IesiCollections.dll
  • log4net.dll
  • MyApplication.dll

Additional namespace imports:

  • HibernatingRhinos.Profiler.Appender.NHibernate

Stack trace for additional information:

   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.Compile(String fileName, String[] sources, IEnumerable`1 assembliesToReference)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(IEnumerable`1 sourcesResources, IEnumerable`1 assembliesToReference, String assemblyName)
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.RegisterAppenderUsingNHibernateLogger()
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.WrapLogger()
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.StartNHibernateProfiling()
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(NHibernateAppenderConfiguration configuration)
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize()
Это было полезно?

Решение

HibernatingRhinos is generating code which it's then trying to compile and failing.

If you can track down the file created by HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.Compile, you should get a better clue as to why it's going wrong.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top