Click here to Skip to main content
15,888,733 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Membership and Roles in a WinForm App Pin
Giorgi Dalakishvili8-Dec-08 6:04
mentorGiorgi Dalakishvili8-Dec-08 6:04 
AnswerRe: Membership and Roles in a WinForm App Pin
#realJSOP11-Dec-08 6:31
mve#realJSOP11-Dec-08 6:31 
QuestionSession Expire Pin
deepakwaje8-Dec-08 2:54
deepakwaje8-Dec-08 2:54 
AnswerRe: Session Expire Pin
Brij8-Dec-08 3:14
mentorBrij8-Dec-08 3:14 
GeneralRe: Session Expire Pin
deepakwaje9-Dec-08 20:38
deepakwaje9-Dec-08 20:38 
GeneralRe: Session Expire Pin
Brij10-Dec-08 0:55
mentorBrij10-Dec-08 0:55 
Questionassigning datakeyname to dynamic gridview Pin
p.s.sriram7-Dec-08 23:44
p.s.sriram7-Dec-08 23:44 
QuestionNhibernate issue with parent / child relationship Pin
Florian DREVET6-Dec-08 12:21
Florian DREVET6-Dec-08 12:21 
Hi there,

I'm using Nhibernate 2.0 and I get a "collection was modified enumeration operation might not execute" exception when NHibernate is in debug mode.

Here is the context (parent / childs relations with lazy loading) :
HelpCategory
---- HelpCategoryLocalized (categories's localized texts)
---- HelpItem (collection of childs items)
-------- HelpItemLocalized (items's localized texts)

I already spent hours and hours to found a solution by myself and with Google but I'm still stuck... and it's really gonna make me crazy OMG | :OMG:

I finally downloaded then debugged NHibernate's source, the exception is thrown "from" the NHibernate.Impl.Printer class whose goal is (stop me if I'm wrong) to show proxied entities in logs (when the NHibernate transaction is commited)

All right, but when I modify and save a HelpCategory entity :
1) the childs HelpItem are proxied but not the HelpItemLocalized before entering the do ... while loop
2) the log.Debug(ToString(enumerator.Current, entityMode)) call load all fields of proxied entities => this behaviour make HelpItemLocalized entities to get proxied IN the loop ! => the collection is changed and throw the exception

Does anyone can tell me if I'm wrong (I use <bag> and <many-to-one> to make the relations) or if it's an NHibernate bug ?

Best regards,

public void ToString(IEnumerator enumerator, EntityMode entityMode)
{
    if (!log.IsDebugEnabled || !enumerator.MoveNext())
    {
        return;
    }

    log.Debug("listing entities:");
    int i = 0;

    do
    {
        if (i++ > 20)
        {
            log.Debug("more......");
            break;
        }
        log.Debug(ToString(enumerator.Current, entityMode));
    } while (enumerator.MoveNext());

QuestionOdd ClickOnce Issue Pin
mjmim5-Dec-08 15:19
mjmim5-Dec-08 15:19 
AnswerRe: Odd ClickOnce Issue Pin
mjmim7-Dec-08 3:52
mjmim7-Dec-08 3:52 
AnswerRe: Odd ClickOnce Issue Pin
Simon P Stevens7-Dec-08 22:44
Simon P Stevens7-Dec-08 22:44 
GeneralRe: Odd ClickOnce Issue Pin
mjmim7-Dec-08 23:07
mjmim7-Dec-08 23:07 
GeneralRe: Odd ClickOnce Issue Pin
Simon P Stevens7-Dec-08 23:18
Simon P Stevens7-Dec-08 23:18 
QuestionDataViews DataTables and DataGridViews and indexing Pin
Ed Hill _5_5-Dec-08 0:23
Ed Hill _5_5-Dec-08 0:23 
AnswerRe: DataViews DataTables and DataGridViews and indexing [modified] Pin
BillyGoatGruff8-Dec-08 5:59
BillyGoatGruff8-Dec-08 5:59 
QuestionMOSS 2007 help required Pin
Saurav Jaiswal4-Dec-08 23:11
Saurav Jaiswal4-Dec-08 23:11 
AnswerRe: MOSS 2007 help required Pin
Saurav Jaiswal9-Dec-08 0:47
Saurav Jaiswal9-Dec-08 0:47 
QuestionConsole Application Help Pin
Dan Suthar4-Dec-08 1:31
professionalDan Suthar4-Dec-08 1:31 
AnswerRe: Console Application Help Pin
Wendelius4-Dec-08 9:46
mentorWendelius4-Dec-08 9:46 
GeneralRe: Console Application Help Pin
Dan Suthar4-Dec-08 20:28
professionalDan Suthar4-Dec-08 20:28 
GeneralRe: Console Application Help Pin
Dave Kreskowiak5-Dec-08 3:28
mveDave Kreskowiak5-Dec-08 3:28 
AnswerRe: Console Application Help Pin
Dan Suthar5-Dec-08 5:53
professionalDan Suthar5-Dec-08 5:53 
GeneralRe: Console Application Help Pin
Wendelius5-Dec-08 7:55
mentorWendelius5-Dec-08 7:55 
QuestionException handling Pin
Umangj3-Dec-08 15:34
Umangj3-Dec-08 15:34 
GeneralRe: Exception handling Pin
Luc Pattyn3-Dec-08 16:08
sitebuilderLuc Pattyn3-Dec-08 16:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.