XS9999 and XS1030

This forum is meant for questions and discussions about the X# language and tools
Post Reply
stecosta66
Posts: 88
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

XS9999 and XS1030

Post by stecosta66 »

Hi all,
total newbie here about X#. Just started to play around and with VO Xporter I've converted a big VO app but when compiling I'm getting the following messages:

1- XS9999: An internal compiler error has occurred: 'Object reference not set to an instance of an object.', at LanguageService.CodeAnalysis.GreenNode.AdjustFlagsAndWidth(GreenNode node)

2 - XS1030 #warning: ' The following method did not include a CLASS declaration'

as per first point I have no clue on whats going on

as per second point I've two methods that extends bBrowser functionality to my needs. I've read the VOPad example in the help and tried to change my code accordingly but still getting the XS1030 warning:

Code: Select all

STATIC CLASS bBrowserExtensions
	STATIC METHOD DeleteItem( SELF obBrowser AS bBrowser ) AS LOGIC
		LOCAL iRecnoID		AS INT

		LOCAL lDeleted      AS LOGIC
		LOCAL lUpdated      AS LOGIC
		LOCAL lEmptyFile	AS LOGIC
		LOCAL lLocked		AS LOGIC
        LOCAL lSuccess		AS LOGIC
        LOCAL lMessage		AS LOGIC

		LOCAL cErrorMsg		AS STRING

		LOCAL symClassName	AS SYMBOL

		lDeleted    := FALSE
		lEmptyFile	:= FALSE
		lLocked		:= FALSE

		cErrorMsg	:= ""


		Default( @lMessage, TRUE )

		// lMessage indica se vogliamo che il messaggio di conferma compaia (lMessage=TRUE) oppure no (lMessage=FALSE)
		IF lMessage
			lSuccess := FabMessageYesNo( obBrowser:Owner, "Vuoi cancellare questo record dall'archivio ?", "Cancella", 2 )

		ELSE
			lSuccess := TRUE

		ENDIF


		IF lSuccess
			symClassName := ClassName( obBrowser:Server )

			obBrowser:Server:SuspendNotification()

			iRecnoID := obBrowser:SelectionFirstRow()
			WHILE iRecnoID > 0

				obBrowser:Server:GoTo( iRecnoID )

				// 14-05-2018: se il server è un bArrayServer la delete( ) è irrevocable (questo parametro non sussiste se il Server è un DB fisico)
				// 10-10-2022: piccola modifica per supportare l'AdoServer in caso di tabella Postgres

				IF symClassName == #bArrayServer
					lDeleted := obBrowser:Server:DELETE( .T. )  	// Cancello il record, lIrrevocable := .T.

				ELSE
					lDeleted := obBrowser:Server:DELETE()  		// Cancello il record

				ENDIF

				IF !lDeleted
					cErrorMsg := "Impossibile cancellare il record dall'archivio"
					EXIT

				ELSE
					iRecnoID := obBrowser:SelectionNextRow()

				ENDIF

			ENDDO

			IF lDeleted
				obBrowser:Server:Commit()
				obBrowser:Server:Unlock()
			ENDIF

			// Se la cancellazione e' andata a buon fine allora controllo
			// se il file e' vuoto oppure mi devo posizionare sul record buono.
			IF lDeleted
				lUpdated := obBrowser:RefreshBrowser( TRUE ) // Refresh del Browse
				IF obBrowser:Server:EoF
					obBrowser:Server:Skip( -1 )
					IF obBrowser:Server:BoF
						lEmptyFile := TRUE
					ENDIF
				ENDIF
			ENDIF

			obBrowser:Server:ResetNotification()

			IF obBrowser:Server:Reccount > 0
				// 10-10-2022: il notify aviene solo se ci sono ancora records da visualizzare. nel caso di un AdoServer
				// 			   se la tabella è vuota è necessario ricorrere ad una Requery() altrimenti il metodo Notify()
				//			   genera un errore a runtime
				obBrowser:Server:Notify( NOTIFYFILECHANGE ) //10-10-2022: NON CAMBIARE IL NOTIFYFILECHANGE

			ELSE
				// bBrowser vuoto
				lEmptyFile := TRUE

				IF symClassName == #ADMAdoServer  .OR. symClassName == #AdoServer
					obBrowser:Server:Requery()

				ELSEIF symClassName == #bArrayServer		// 23-10-2022: aggiunto il refresh del browse in caso di "file vuoto" per il bArrayServer
					obBrowser:Server:Notify( NOTIFYFILECHANGE )

				ENDIF

			ENDIF

		ENDIF

		IF !Empty( cErrorMsg )
			FabMessageAlert( obBrowser:Owner, cErrorMsg )
		ENDIF

		IF lEmptyFile
			FabMessageInfo( obBrowser:Owner, "File vuoto!" )
		ENDIF

		cErrorMsg := NULL_STRING

	RETURN lDeleted

	STATIC METHOD RefreshBrowser( SELF obBrowser AS bBrowser) AS LOGIC
        LOCAL lUpdated       AS LOGIC
        LOCAL lRetainSelection AS LOGIC
		LOCAL symRefreshMode AS SYMBOL

		lUpdated := TRUE
		Default( @lRetainSelection, FALSE )

		IF !lRetainSelection
			symRefreshMode := #RefreshBuffer
		ELSE
			symRefreshMode := #RetainCurrentRow
		ENDIF

		IF obBrowser:SelectionRowCount > 1
			lUpdated := obBrowser:SelectionRemove(#All)
		ENDIF

		IF obBrowser:Server:Reccount > 0
			obBrowser:SelectionSet(#Single,obBrowser:CurrentColumn,obBrowser:CurrentRow,obBrowser:Server:RECNO)
			obBrowser:SetFocus()
			lUpdated := obBrowser:Refresh(symRefreshMode)
		ENDIF

	RETURN lUpdated
END CLASS
What I'm doing wrong?

Using X# 2.21.0.5

Stefano
User avatar
Chris
Posts: 4977
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: XS9999 and XS1030

Post by Chris »

Hi Stefano,

You have adjusted your code well! The warning comes from a #warning directive that VOXporter inserted in the code, in order to draw your attention to the issue, but now that you have taken care of it, you can simply remove it from the source code. To find it quickly, just double click on the warning message, and the cursor shoul be moved to the exact location of the directive.

Unfortunately the other problem is more tricky, it means that the compiler found some code that it did not expect and could not handle it. It's a compiler bug (that at least it does not catch the situation and give a proper error message), but it will not be easy for you to locate it. Best solution is if you can zip and send us the full exported project, so we can run the compiler itself through the debugger with it and find exactly what the issue is (and fix it). If that's not possible, I will give you some instructions on how you can try and find the problem yourself.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3783
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: XS9999 and XS1030

Post by wriedmann »

Ciao Stefano,
if I can give you a recommendation: don't start with a big application!
The compatibility of X# to VO is really high - much better that I have ever expected knowning my own code, but starting with a big application you may have to do several adjustments to have the first success.
I don't know the structure of you applications, but I suppose you have some libraries that are used by all applications. So I would a test application that uses some of them and migrate that first, and make work that step by step. In later migration phases you can use than this test application to check out problems you have in your libraries.
And another recommendation: do all changes also on the VO side, maybe using conditional compilation, so you can always migrate your application from VO without loosing your changes.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
stecosta66
Posts: 88
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

Re: XS9999 and XS1030

Post by stecosta66 »

Chris wrote: Sat Nov 30, 2024 8:47 pm Hi Stefano,

You have adjusted your code well! The warning comes from a #warning directive that VOXporter inserted in the code, in order to draw your attention to the issue, but now that you have taken care of it, you can simply remove it from the source code. To find it quickly, just double click on the warning message, and the cursor shoul be moved to the exact location of the directive.

Unfortunately the other problem is more tricky, it means that the compiler found some code that it did not expect and could not handle it. It's a compiler bug (that at least it does not catch the situation and give a proper error message), but it will not be easy for you to locate it. Best solution is if you can zip and send us the full exported project, so we can run the compiler itself through the debugger with it and find exactly what the issue is (and fix it). If that's not possible, I will give you some instructions on how you can try and find the problem yourself.
Hi Chris,

about the XS1030 thanks, that was it!

Now I'm stuck on XS9999. I'll zip the solution and send it to you

thanks again
Stefano
stecosta66
Posts: 88
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

Re: XS9999 and XS1030

Post by stecosta66 »

Ciao Wolfgang,

thanks for recommendation, I just started to play around just to see how things work.

This big app include serveral libs and for now I'm adapting function module from VO to X#. This will be a slow process and obviously this is only the first step

Plan is to keep VO and X# code updated on both sides

thanks a lot for the suggestions
Stefano

wriedmann wrote: Sun Dec 01, 2024 6:51 am Ciao Stefano,
if I can give you a recommendation: don't start with a big application!
The compatibility of X# to VO is really high - much better that I have ever expected knowning my own code, but starting with a big application you may have to do several adjustments to have the first success.
I don't know the structure of you applications, but I suppose you have some libraries that are used by all applications. So I would a test application that uses some of them and migrate that first, and make work that step by step. In later migration phases you can use than this test application to check out problems you have in your libraries.
And another recommendation: do all changes also on the VO side, maybe using conditional compilation, so you can always migrate your application from VO without loosing your changes.
Wolfgang
User avatar
wriedmann
Posts: 3783
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: XS9999 and XS1030

Post by wriedmann »

Ciao Stefano,
it is a really good idea to keep code synchronized on both sides.
We have our VO framework that was originally built on VO 1.0 and developed over the years, and we are enhancing it until today in its VO version, and since we have several X# applications in production that are based on VO code (both migrated and newly built), we migrate these libraries regularly to X#.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4977
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: XS9999 and XS1030

Post by Chris »

Hi Stefano,

Thanks for sending the code, found the problem, it's in those two function definitions:

Code: Select all

FUNCTION OpenExcel( cFile AS STRING, dwCols AS DWORD, dwRows AS DWORD, aMastri := NULL_ARRAY AS ARRAY, ;
					aTitle := NULL_ARRAY AS ARRAY, dwNumRate := 0 AS DWORD, dwRataStartCol := 0 AS DWORD, ;
					aFooter := NULL_ARRAY AS ARRAY, cType := NULL_STRING AS STRING, lNote := .T. AS LOGIC, ;
					aMultiLineParams := NULL_ARRAY AS ARRAY, dwOrientation := 2 AS DWORD, aOffSet2Bold := NULL_ARRAY AS ARRAY, ;
					lFirma := .F. AS LOGIC, lCellFormat := .F. AS LOGIC, aOffSet2Bold2 := NULL_ARRAY AS ARRAY, ;
					lPageSetup := .F. AS LOGIC, dwPageZoom := 85, dwStartRata := 1 AS DWORD, lAnticipazione := .F. AS LOGIC, ;
					lIncludeLogo := .F. AS LOGIC, lInsertRowMastri := .T. AS LOGIC, aMastriStr := NULL_ARRAY AS ARRAY, ;
					dwStartColMastriStr := 1 AS DWORD, lIncludeFooterBorder := .T. AS LOGIC ) AS LOGIC PASCAL

FUNCTION OpenExcel3( cFile AS STRING, dwCols AS DWORD, dwRows AS DWORD, aMastri := NULL_ARRAY AS ARRAY, ;
					aTitle AS ARRAY, dwNumRate := 0 AS DWORD, dwRataStartCol := 0 AS DWORD, ;
					aFooter := NULL_ARRAY AS ARRAY, lFirstPaymentCol := .F. AS LOGIC, lNote := .T. AS LOGIC, ;
					aMultiLineParams := NULL_ARRAY AS ARRAY, dwOrientation := 2 AS DWORD, aOffSet2Bold := NULL_ARRAY AS ARRAY, ;
					lFirma := .F. AS LOGIC, lCellFormat := .F. AS LOGIC, aOffSet2Bold2 := NULL_ARRAY AS ARRAY, ;
					lPageSetup := .F. AS LOGIC, dwPageZoom := 85, dwStartRata := 1 AS DWORD, lAnticipazione := .F. AS LOGIC, lIncludeLogo := .F. AS LOGIC ) AS 
In both of them, the dwPageZoom parameter does not have a type and the compiler did not handle this properly. If you add a parameter type as in dwPageZoom := 85 AS DWORD, then the error will go away.

I will log the issue to be fixed in the compiler.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
stecosta66
Posts: 88
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

Re: XS9999 and XS1030

Post by stecosta66 »

Ciao Wolfgang,

just started digging into the X# world and I must say that it have really a great degree of compatibility with VO code and much tighter rules about strong typing and missing pieces of code. I like it!

this is just the beginning but I'm enjoing it.

Great work from the dev team!

Ciao
Stefano
wriedmann wrote: Sun Dec 01, 2024 9:08 am Ciao Stefano,
it is a really good idea to keep code synchronized on both sides.
We have our VO framework that was originally built on VO 1.0 and developed over the years, and we are enhancing it until today in its VO version, and since we have several X# applications in production that are based on VO code (both migrated and newly built), we migrate these libraries regularly to X#.
Wolfgang
stecosta66
Posts: 88
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

Re: XS9999 and XS1030

Post by stecosta66 »

Thanks Chris,

I totally overlooked that dwPageZoom paramenter doen't have a type, VO compiler doesn't bother about that.

For now I must admit that I'm really linking what I see about X#

great work!

Thanks again for your support
Stefano
Chris wrote: Sun Dec 01, 2024 9:40 am Hi Stefano,

Thanks for sending the code, found the problem, it's in those two function definitions:

Code: Select all

FUNCTION OpenExcel( cFile AS STRING, dwCols AS DWORD, dwRows AS DWORD, aMastri := NULL_ARRAY AS ARRAY, ;
					aTitle := NULL_ARRAY AS ARRAY, dwNumRate := 0 AS DWORD, dwRataStartCol := 0 AS DWORD, ;
					aFooter := NULL_ARRAY AS ARRAY, cType := NULL_STRING AS STRING, lNote := .T. AS LOGIC, ;
					aMultiLineParams := NULL_ARRAY AS ARRAY, dwOrientation := 2 AS DWORD, aOffSet2Bold := NULL_ARRAY AS ARRAY, ;
					lFirma := .F. AS LOGIC, lCellFormat := .F. AS LOGIC, aOffSet2Bold2 := NULL_ARRAY AS ARRAY, ;
					lPageSetup := .F. AS LOGIC, dwPageZoom := 85, dwStartRata := 1 AS DWORD, lAnticipazione := .F. AS LOGIC, ;
					lIncludeLogo := .F. AS LOGIC, lInsertRowMastri := .T. AS LOGIC, aMastriStr := NULL_ARRAY AS ARRAY, ;
					dwStartColMastriStr := 1 AS DWORD, lIncludeFooterBorder := .T. AS LOGIC ) AS LOGIC PASCAL

FUNCTION OpenExcel3( cFile AS STRING, dwCols AS DWORD, dwRows AS DWORD, aMastri := NULL_ARRAY AS ARRAY, ;
					aTitle AS ARRAY, dwNumRate := 0 AS DWORD, dwRataStartCol := 0 AS DWORD, ;
					aFooter := NULL_ARRAY AS ARRAY, lFirstPaymentCol := .F. AS LOGIC, lNote := .T. AS LOGIC, ;
					aMultiLineParams := NULL_ARRAY AS ARRAY, dwOrientation := 2 AS DWORD, aOffSet2Bold := NULL_ARRAY AS ARRAY, ;
					lFirma := .F. AS LOGIC, lCellFormat := .F. AS LOGIC, aOffSet2Bold2 := NULL_ARRAY AS ARRAY, ;
					lPageSetup := .F. AS LOGIC, dwPageZoom := 85, dwStartRata := 1 AS DWORD, lAnticipazione := .F. AS LOGIC, lIncludeLogo := .F. AS LOGIC ) AS 
In both of them, the dwPageZoom parameter does not have a type and the compiler did not handle this properly. If you add a parameter type as in dwPageZoom := 85 AS DWORD, then the error will go away.

I will log the issue to be fixed in the compiler.
User avatar
Chris
Posts: 4977
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: XS9999 and XS1030

Post by Chris »

Hi Stefano,

You're welcome and thanks, it's been a long journey, but we are also satisfied now with the level of compatibility we've achieved for porting apps (from VO for now) to X#. Please don't hesitate to ask if you have any questions or face any other problems!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply