Since assertion you are seeing is in excepx86.cpp, my guess is that your
code hit access violation. You can verify it by running the program
under debugger with stop on exception set (in Visual Studio, go to Debug
/ Exceptions and check break into debugger for "Win32 exceptions").

If this does not help, can you please send a full callstack for the
assertion?

-Jan

This posting is provided "AS IS" with no warranties, and confers no
rights.

-----Original Message-----
From: Discussion of the Rotor Shared Source CLI implementation
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Tavares
Sent: Saturday, August 09, 2003 10:18 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] !GCForbidden assertion: why?

Hi all.

I just modified the Jit_GetField32 helper function to make a call out to
C++
function, and now I get a ton of assertions like this:

Assert failure(PID 2108 [0x0000083c], Thread: 2456 [0x998]):
!GetThread()->GCFor
bidden()
    File:
c:\home\chris\projects\rotor\src\sscli\clr\src\vm\rotor_x86\../i386/exce
px86
.cpp, Line: 592 Image:
C:\Home\Chris\Projects\Rotor\src\sscli\build\v1.x86chk.rotor\clix.exe


I thought the whole point of the helper function frame was to take care
of
this stuff. What do I need to do to either 1) say that GC is forbidden
here,
but it's ok, or 2) not forbid the GC.

I put my call just before the call to FC_GC_POLL_RET() at the end of
JIT_GetField32 (jitinterface.cpp, line 5480); it's just:

        objRef->Release();

where Release is a new member function of class object that I've added
previously; here's the code for that:

void Object::Release()
{
    LONG *pRefCount = FindRefCount();
    if( pRefCount != 0 && *pRefCount != 0 )
    {
        _ASSERTE( *pRefCount > 0 );
        LONG newref = InterlockedDecrement( pRefCount );
#ifdef _DEBUG
        RC_LOG(( LF_REFCOUNT, LL_REFCOUNT, "Release on object at %p of
type
%s, refcount now %d\n", this, GetClass()->GetDebugClassName(), newref
));
#else
        RC_LOG(( LF_REFCOUNT, LL_REFCOUNT, "Release on object at %p,
refcount now %d\n", this, newref ));
#endif
        if( newref == 0 )
        {
#ifdef _DEBUG
            RC_LOG((LF_REFCOUNT, LL_REFCOUNT, "Object at %p of type %s
refcount now 0, finalizing\n", this, GetClass()->GetDebugClassName() ));
#else
            RC_LOG((LF_REFCOUNT, LL_REFCOUNT, "Object at %p refcount now
0,
finalizing\n", this ));
#endif
    }
}

All it's doing is decrementing a long and doing some logging. It will do
some more work in the future (calling the finalizer for one) so some
suggestions that would allow calls back into managed code from this
function
would be very helpful.

Any suggestions?

Thanks,

-Chris

Reply via email to