Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: Unkown name error under COM+
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00787371
Message ID:
00787672
Views:
18
Thanks Tony,

No word yet from anyone at MS to confirm the bug or for a better workaround :( This bug it pretty severe, it can break an app at places you would never think about. Hopefully MS will work on the problem and create a workable workaround or even better a service pack.

The workaround i found is actually not very good for real life situations, this would mean all classes in a dll must have all common functions and properties. i checked and one of my dll would end-up with a lot of unused functions which will make anybody atempting to code against my objects *very* confused to find the same function and properties in all objects without beeing implemented in all objects.

The problem is not only for functions but also appears with public properties.

After a bit more testing i also found you can recreate the problem with only one VFP session:
o1 = CreateObject("ErrorTest1.ComServer1")
o2 = CreateObject("ErrorTest1.ComServer2")
=o2.ReturnHello2() && Error: Unknown name
o1=Null
=o2.ReturnHello2() && No error
>Hi Stephane,
>
>I create a prg from your solution, it create all the necessary procedure in the baseclass.
>
>DEFINE CLASS MySession AS Session
>*** Do Not Remove ***
>EndDefine
>
>CLEAR
>CLOSE ALL
>cDefaultPath = [Default Path]
>fBaseClass = [BaseClass.PRG]
>cProjectName = [Project Name]
>cDllFileName = [Dll File Name]
>
>SET DEFAULT TO &cDefaultPath
>CREATE CURSOR ProcName (Prg C(20), ProcName M)
>INDEX ON LEFT(ProcName, 50) TAG ProcN
>MODIFY PROJECT &cProjectName NOWAIT NOSHOW NOPROJECTHOOK
>FOR nIndex = 1 TO _VFP.ActiveProject.Files.Count
> DO CASE
> CASE _VFP.ActiveProject.Files.Item(nIndex).Type # "P"
> CASE fBaseClass $ _VFP.ActiveProject.Files.Item(nIndex).Name
> cbaseclass = FILETOSTR(_VFP.ActiveProject.Files.Item(nIndex).Name)
> OTHERWISE
> cFile = CHRTRAN(FILETOSTR(_VFP.ActiveProject.Files.Item(nIndex).Name), CHR(9), "")
> IF "OLEPUBLIC" $ cFile
> ALINES(aFile, cFile, .T., CHR(10))
> nFound = ASCAN(aFile, "PROCEDURE")
> DO WHILE nFound # 0
> aFile[nFound] = ALLTRIM(aFile[nFound])
> IF RIGHT(aFile[nFound], 1) = ";"
> cProcLine = aFile[nFound]
> DO WHILE RIGHT(aFile[nFound], 1) = ";" AND nFound # ALEN(aFile, 1)
> IF nFound # ALEN(aFile, 1)
> nFound = nFound + 1
> aFile[nFound] = ALLTRIM(aFile[nFound])
> cProcLine = cProcLine + " " + aFile[nFound]
> ENDIF
> ENDDO
> cProcLine = CHRTRAN(cProcLine, ";", "")
> ELSE
> cProcLine = aFile[nFound]
> ENDIF
> INSERT INTO ProcName VALUES ;
> (JUSTFNAME(_VFP.ActiveProject.Files.Item(nIndex).Name), cProcLine)
> nFound = ASCAN(aFile, "PROCEDURE", nFound+1)
> ENDDO
> ENDIF
> ENDCASE
>ENDFOR
>SELECT ProcName
>cReplace = ""
>SCAN
> cReplace = cReplace ;
> + CHR(9) ;
> + ALLTRIM(STRTRAN(ProcName, STREXTRACT(ProcName, "(", ")"), "")) ;
> + CHR(13) + CHR(10)
>ENDSCAN
>TRY
> SET SAFETY OFF
> STRTOFILE(STRTRAN(cbaseclass, "*** Do Not Remove ***", cReplace), fBaseClass, 0)
> SET SAFETY ON
> _VFP.ActiveProject.Close
> BUILD MTDLL &cDllFileName FROM &cProjectName
> MODIFY PROJECT &cProjectName NOWAIT NOSHOW NOPROJECTHOOK
>CATCH TO oErr
> ? oErr.Message
>FINALLY
> SET SAFETY OFF
> STRTOFILE(cbaseclass, fBaseClass, 0)
> SET SAFETY ON
>ENDTRY
>MODIFY PROJECT &cProjectName NOWAIT
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform