The type initializer for 'NHibernate.ByteCode.LinFu.ProxyFactory' threw an exception.
Today most of my time was spent around the Exception figuring out what made this error to be thrown by nhibernate. It was weird as the application was compiling without any warnings or Errors, and, was running without any problems till it tried to access the database.
Exception thrown was not helpful at all as it said “object reference not set….. “And there weren’t any inner exceptions as well.
Therefore the exception handling in the application was improved by including the Build session factory method in side an exception block. When the error was logged it said “The type initializer for 'NHibernate.ByteCode.LinFu.ProxyFactory' threw an exception”. The next question was how come ? as my code never accessed the LinFu proxy factory directly and it was part of the nhibernates business to do so.
In fact the problem for me was that as the proxy is being loaded dynamically, Visual Studio does not copy all the dependencies properly to the bin dir. or bin\debug dir.
Simply I had to manually copy the nhibernate dependencies to the bin folder. This fixed the problem, though it’s weird that the LinFu Proxy is not copied to the bin folder even though there is a reference from my Data Layer.
Tuesday, September 28, 2010
Sunday, September 26, 2010
The referenced assembly "some.dll" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=
The referenced assembly "some.dll" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
This annoying exception tormented me for almost a day, while I was developing and WPF - nhibernate application using VS 2010.
By the way the error had nothing to do with either nhibernate or WPF. As I found out this was due to the more compact version of the .NET framework (client profile) introduced with VS2010.
Resolution – By Default the desktop client applications like Windows Forms and WPF applications) targets .NET Framework (Client profile) as client profile is just a subset of the .NET framework introduced to improve the deployment experience. Therefore re-target your applications to Full .NET framework instead of the compact framework to get rid of the Error. As you can see the error pops up only when you refernce assemblies like System.Web, System.Data.OracleClient etc. which are not part of the Compact framework.
There is a good article on the two Frameworks here: http://blogs.msdn.com/b/jgoldb/archive/2009/10/19/what-s-new-in-net-framework-4-client-profile-beta-2.aspx
This annoying exception tormented me for almost a day, while I was developing and WPF - nhibernate application using VS 2010.
By the way the error had nothing to do with either nhibernate or WPF. As I found out this was due to the more compact version of the .NET framework (client profile) introduced with VS2010.
Resolution – By Default the desktop client applications like Windows Forms and WPF applications) targets .NET Framework (Client profile) as client profile is just a subset of the .NET framework introduced to improve the deployment experience. Therefore re-target your applications to Full .NET framework instead of the compact framework to get rid of the Error. As you can see the error pops up only when you refernce assemblies like System.Web, System.Data.OracleClient etc. which are not part of the Compact framework.
There is a good article on the two Frameworks here: http://blogs.msdn.com/b/jgoldb/archive/2009/10/19/what-s-new-in-net-framework-4-client-profile-beta-2.aspx
Sunday, March 21, 2010
[Prevent saving changes] SQL Server/Express 2008
Saving changes is not Permitted. The Changes you have made require the following tables to be dropped or re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.
This is an annoying message that is prompted when trying to make changes to a table in SQL Server 2008/Express. While there can be many valid reasons for having this option [Prevent saving changes] switched on by default you would prefer to have this switched off during the implementation phase of the project.
Steps to disable the option [Prevent saving changes]
This is an annoying message that is prompted when trying to make changes to a table in SQL Server 2008/Express. While there can be many valid reasons for having this option [Prevent saving changes] switched on by default you would prefer to have this switched off during the implementation phase of the project.
Steps to disable the option [Prevent saving changes]
- Click on the Tools menu
- Click on Options of the Management Studio
- Click on the “Designers” tree
- Click on “Table and Database Designers”
- Uncheck “Prevent saving changes that require table-creation”
- Click “Ok”
Thursday, March 11, 2010
HTTP could not register URL http://+:8000/.
When i was trying to execute a WCF application created using a previos version of Windows (XP) came across the following error.
HTTP could not register URL http://+:8000/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)
You can expect this error when trying to run a WCF service with an HTTP binding on windows VISTA. As you may have already noticed the culprit is the new Vista security settings. Usually the Visual Studio runs under the logged in user account which may not have sufficient priviledges to listen at a particular http address.
Find the solution here - http://blogs.msdn.com/amitlale/archive/2007/01/29/addressaccessdeniedexception-cause-and-solution.aspx
Onething missing in the solutions was how to run the command prompt as the administrator.Type "command Prompt" - in the start search box, then the command prompt would appear in the search results list, right click an say run as administrator.
But you can avoid all this hassel by running the VS studio as the administrator. :o) have fun!!
HTTP could not register URL http://+:8000/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)
You can expect this error when trying to run a WCF service with an HTTP binding on windows VISTA. As you may have already noticed the culprit is the new Vista security settings. Usually the Visual Studio runs under the logged in user account which may not have sufficient priviledges to listen at a particular http address.
Find the solution here - http://blogs.msdn.com/amitlale/archive/2007/01/29/addressaccessdeniedexception-cause-and-solution.aspx
Onething missing in the solutions was how to run the command prompt as the administrator.Type "command Prompt" - in the start search box, then the command prompt would appear in the search results list, right click an say run as administrator.
But you can avoid all this hassel by running the VS studio as the administrator. :o) have fun!!
Sunday, February 28, 2010
Monday, February 22, 2010
Subscribe to:
Comments (Atom)
