Hi Stephane,
I've tested your code in the following configurations:
1) WinXP, instantiation locally
2) WinXP client with CRETEOBJECTEX(), component on W2KSP3 Server
compiled and tested with VFP8 - no problems. Did you manipulate any of the default settings for the COM+ application or the component?
I've noticed one thing that IMO won't really matter, but to be sure:
Store NULL TO loCom, loContext
You could switch the order in which the objects are destroyed like so:
Store NULL TO loContext, loCom
>File: .\jit.cpp, Line: 78
hmmm ... jit = Just In Time Activation ... I've had this set to on, but no problem.
Armin
>If i call a COM+ component twice and the first call called setcomplete(), the second call will succeed but the application crashes when the instance is destroyed.
>
>Can anybody explain? Is this a bug ?
>
>- Put the following code into a new project called TestC5
>- Build as a MTDLL
>- Add To a new or existent COM+ Application
>
>PS. I am running Win2K server SP3, i compilled with VFP7 SP1 and also tried with VFP8 and getting the same result.
>
>
>Define Class TestC5 As Session OLEPUBLIC
>
> Function Test1()
>
> This.EndTransaction()
> Return "Test1"
>
> EndFunc
>
> Function Test2
> Return "Test2"
> EndFunc
>
> Protected Function EndTransaction()
>
> Local loCom, loContext, loContextState
>
> loCom = CREATEOBJECT( "MTXAS.APPSERVER.1" )
> loContext = loCom.GetObjectContext()
>
> loContext.SetComplete()
>
> Store NULL TO loCom, loContext
>
> EndFunc
>
>EndDefine
>
>
>Then run the following:
>
>
>ox = CreateObject("TestC5.TestC5")
>? ox.Test1()
>? ox.Test2()
>ox=Null
>
>
>
>The error i get in the application event log is the following:
>
>COM+ Internal Error. Please contact Microsoft Product Support Services to report this error. Assertion Failure:
>!m_fActivated
>Server Application ID: {F6BBDE6A-DCA5-4654-8266-0DCCF336F2E7}
>Server Application Name: TestC5
>The serious nature of this error has caused the process to terminate.
>COM+ Services Internals Information:
>File: .\jit.cpp, Line: 78
>