-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: NHibernate.Cfg.Environment Exception
PostPosted: Fri May 19, 2006 8:31 am 
Beginner
Beginner

Joined: Fri Dec 23, 2005 6:05 am
Posts: 42
Hello,

I wanted to check out generics in NHibernate. Therefore I got me the newest svn version (2067).
I am relatively new to NHibernate so I started off with two simple classes. They only have one simple string property.

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
  <class name="NHibernateTest.TV, NHibernateTest">
    <id name="Id" type="Int32">
      <generator class="native" />
    </id>
    <property name="Company" type="String"/>
  </class>
</hibernate-mapping>

and
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
  <class name="NHibernateTest.Person, NHibernateTest">
    <id name="Id" type="Int32">
      <generator class="native" />
    </id>
    <property name="Firstname" type="String" />
   
  </class>
</hibernate-mapping>


but everytimeI start my program it fails telling me
Code:
Der Typeninitialisierer für NHibernate.Cfg.Environment hat eine Ausnahme verursacht. (That means in english: The type initializer for NHibernate.Cfg.Environment has caused an Exception

It happens when calling
Code:
config = new Configuration();


I used the actual Nhibernate version, and it works great. Is there something you have to set up before using the new one?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 9:23 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
I guess I just messed something up in the svn version. Can you post the full exception stack trace?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 9:34 am 
Beginner
Beginner

Joined: Fri Dec 23, 2005 6:05 am
Posts: 42
here it goes:
Code:
System.TypeInitializationException wurde nicht behandelt.
  Message="Der Typeninitialisierer für NHibernate.Cfg.Environment hat eine Ausnahme verursacht."
  Source="NHibernate"
  TypeName="NHibernate.Cfg.Environment"
  StackTrace:
       bei NHibernate.Cfg.Environment.get_Properties()
       bei NHibernate.Cfg.Configuration.Reset() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernate Beta\nhibernate\src\NHibernate\Cfg\Configuration.cs:Zeile 121.
       bei NHibernate.Cfg.Configuration..ctor() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernate Beta\nhibernate\src\NHibernate\Cfg\Configuration.cs:Zeile 180.
       bei NHibernateTest.Start.init() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernateTest\NHibernateTest\NHibernateTest\Start.cs:Zeile 23.
       bei NHibernateTest.Start..ctor() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernateTest\NHibernateTest\NHibernateTest\Start.cs:Zeile 15.
       bei NHibernateTest.Program.Main(String[] args) in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernateTest\NHibernateTest\NHibernateTest\Program.cs:Zeile 11.
       bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       bei System.Threading.ThreadHelper.ThreadStart()


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 11:11 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Is there anything in that exception's InnerException property? This one doesn't point exactly to where the error is.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 11:33 am 
Beginner
Beginner

Joined: Fri Dec 23, 2005 6:05 am
Posts: 42
sergey wrote:
Is there anything in that exception's InnerException property? This one doesn't point exactly to where the error is.


I hope this will help more.

Code:
InnerException:
{"Der Index war außerhalb des Arraybereichs."}

[System.IndexOutOfRangeExecption]:
{"Der Index war außerhalb des Arraybereichs."}

Source:
"NHibernate"

StackTrace:
   bei NHibernate.Cfg.Environment.get_Version() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernate Beta\nhibernate\src\NHibernate\Cfg\Environment.cs:Zeile 51.
   bei NHibernate.Cfg.Environment..cctor() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernate Beta\nhibernate\src\NHibernate\Cfg\Environment.cs:Zeile 137.
   bei NHibernate.Cfg.Environment.get_Version() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernate Beta\nhibernate\src\NHibernate\Cfg\Environment.cs:Zeile 51.
   bei NHibernate.Cfg.Environment..cctor() in C:\Dokumente und Einstellungen\admin\Eigene Dateien\Eigene Projekte\NHibernate Beta\nhibernate\src\NHibernate\Cfg\Environment.cs:Zeile 137.

TargetSite:
{System.String get_Version()}
[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 11:56 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Ok I'll fix it in SVN. The code relies on NHibernate.dll having an AssemblyInformationalVersionAttribute, but it apparently isn't present in your build for some reason.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 4:15 am 
Beginner
Beginner

Joined: Fri Dec 23, 2005 6:05 am
Posts: 42
sergey wrote:
Ok I'll fix it in SVN. The code relies on NHibernate.dll having an AssemblyInformationalVersionAttribute, but it apparently isn't present in your build for some reason.


Thanks alot. It seems to work now, though I ran into the next problem. But this is something for an other topic. ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.