OpenPrinterDialog crashing

The following code crashes consistently

PageSetup = NEW PrinterSetup // create printer setup dialog
PageWidth = PageSetup.Width // save the page width
PageHeight = PageSetup.Height // save the page height
PageSizeSet = TRUE // the page size has been set
PageSetup.Landscape = FALSE // default to tabular reports
PageSettings = PageSetup.SetupString // save these page settings

IF (PageSettings <> “”) THEN
MsgBox “A”
g = OpenPrinterDialog(PageSetup,Window(0))
MsgBox “B”
ELSE
g = OpenPrinterDialog(NIL,Window(0))
END IF

Msgbox “A” is displayed, then it crashes. Msgbox “B” is not displayed

Window(0) is not nil
This code has worked for years, so I’m baffled as to why it is crashing. Unless this is related to some new changes in the MacOS.

Anyone else having this problem. I did not see any new conversations addressing this issue. Thanks TJ

well I just executed this code

		dim pagesetup as PrinterSetup
		dim pagewidth as integer
		dim pageheight as integer
		dim pagesizeset as boolean
		dim g as graphics
		dim pagesettings as string
		
		PageSetup = NEW PrinterSetup // create printer setup dialog
		PageWidth = PageSetup.Width // save the page width
		PageHeight = PageSetup.Height // save the page height
		PageSizeSet = TRUE // the page size has been set
		PageSetup.Landscape = FALSE // default to tabular reports
		PageSettings = PageSetup.SetupString // save these page settings
		
		IF (PageSettings <> "") THEN
				MsgBox "A"
				g = OpenPrinterDialog(PageSetup,Window(0))
				MsgBox "B"
		ELSE
				g = OpenPrinterDialog(NIL,Window(0))
		END IF

and it worked just fine…
Note : I did add all the DIM statements to make it compilable… but other than that it is cut/paste from above

macOS 10.11.6
Xojo 2016r4.1

In the future, please enclose you code snippets in the appropriate tags… it makes it much easier to see

Versions might be the problem

macOS 10.13
Xojo 2017 r1.1

Do you have the crash log?