Agree, it's not a bug.
And it's not NHibernate's job to prevent the user do stupid things. But will
be nice if it can do so...
Receiving an EngineExecutionException from .NET Framework is scaring :)
Will it be possible to do a check for this kind of things and throw a
meaningful exception instead?
Anyway, thanks...
On Wed, Dec 10, 2008 at 12:05 PM, Fabio Maulo <[EMAIL PROTECTED]> wrote:
> It is not a NH bug.You are declaring a "Decimal" type but, using the
> getter, NH receive a Money type.
> Obviously using the field there are no problem.
> The JIRA will be closed as Not an issue.
>
> 2008/12/10 Valeriu Caraulean <[EMAIL PROTECTED]>
>
> I'll pop up the case with some details.So, the domain if you haven't
>> looked to attached solution:
>>
>> public class Person
>> {
>> private decimal salary;
>> public virtual int Id { get; set; }
>>
>> public void SetSalary(decimal amount)
>> {
>> Salary = new Money(amount);
>> }
>>
>> public Money Salary
>> {
>> get { return new Money(salary); }
>> protected set { salary = value.Amount; }
>> }
>> }
>>
>> public class Money : IConvertible
>> {
>> private readonly decimal amount;
>>
>> public Money(decimal amount)
>> {
>> this.amount = amount;
>> }
>>
>> public decimal Amount
>> {
>> get { return amount; }
>> }
>>
>> #region Implementation of IConvertible
>> #endregion
>> }
>>
>> & the mapping:
>> <class name="Person">
>> <id name="Id" type="int">
>> <generator class="increment" />
>> </id>
>> <property name="Salary" type="Decimal" access="nosetter.camelcase"/>
>> </class>
>>
>> I've received from Microsoft engineers information about similar issue
>> (ExecutionEngineException
>> thrown with same internal call stack):
>> *"** **The problem was due to an illegal IL sequence. The code did a load
>> of an int32 and tried to store it into a valuetype.*
>>
>> *The problem in your case is likely to be similar. The problem will
>> likely be in the dynamically generated IL sequence, where it has a int32 or
>> similar primitive type and it does a stloc into a value type."* *[ so
>> note - this is talking about a very similar case but not your case
>> specifically ]*"
>> So, it's very possible that NHibernate does something that causes the
>> problem.
>>
>> Valeriu
>>
>> On Mon, Dec 8, 2008 at 11:43 AM, Valeriu Caraulean <[EMAIL PROTECTED]>wrote:
>>
>>> Hi everybody
>>>
>>> I've managed to receive a 'System.ExecutionEngineException' in a specific
>>> use case of NHibernate. The case is easily reproduced on trunk,
>>> revision 3943. ByteCode provider - Castle.
>>>
>>> JIRA - NH-1599 <http://jira.nhibernate.org/browse/NH-1599>
>>> Microsoft Connect - bug
>>> report<https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=384781>
>>> .
>>> Also, I'm in touch with a guy from MS that managed to open a support case
>>> for this issue.
>>>
>>> To reproduce, build & run attached solution. It is a console program. It
>>> shows the issue better than a unit test.
>>>
>>> Before building:
>>> - Add NHibernate's assemblies to "Libs" folder. ByteCode provider -
>>> Castle.
>>> - Adjust connection string in app.config
>>>
>>> I've found a workaround that worked for me. I've changed the access mode
>>> to property, from "nosetter.camelcase" to "field.camelcase". And it was
>>> enough to make the program run like a charm. See the mapping file...
>>>
>>> Valeriu
>>>
>>
>>
>
>
> --
> Fabio Maulo
>