--dxPrnPg.pas
procedure TdxPrinterPage.ApplyToPrintDevice;
var
APaperInfo: TdxPaperInfo;
begin
if dxPrnDev.dxInitPrintDevice(False) then
begin
dxPrnDev.dxPrintDevice.ColorMode := not GrayShading;
dxPrnDev.dxPrintDevice.Orientation := Orientation;
dxPrnDev.dxPrintDevice.SelectPaper(DMPaper);
if DMPaper >= DMPAPER_USER then
begin
APaperInfo := TdxPaperInfo(dxPrnDev.dxPrintDevice.Papers.Objects[dxPrnDev.dxPrintDevice.PaperIndex]); //AV Code
APaperInfo.Width := PageSizeLoMetric.X;
APaperInfo.Height := PageSizeLoMetric.Y;
end;
dxPrnDev.dxPrintDevice.SelectBin(PaperSource);
end;
end;
Hello.
I am getting access violation when creating TForm that includes a TdkxGridDBBandedTableView - That is if the Default Printer is invalid (network printer not found on server) on my machine. The bold source-code line above is the one that throws the AV error.
Best Regards
Johann
When debugging I found out that dxPrnDev.dxPrintDevice.Papers is NIL.
I have same problems, described in https://www.devexpress.com/Support/Center/Question/Details/T588656/av-when-run-spreadsheetfeaturesdemo-exe
Hello Johann,
Would you please specify your Windows 10 build version? Do you have the latest update installed? Do you have any default printer in your system? Thanks in advance.
I have Default Printer that is a Network printer. I am using HP Universal Printing PCL 5 but that is not the problem. The problem is that the printer who is selected as Default is currently unavailable (I get error if I try to go to Properties on it in Windows).
I have latest update of Windows 10.
One thing that I did not mention earlier, I have also TdxComponentPrinter dropped on my form.
Thanks. Would you please put a break point to this procedure, get the values of the following properties and provide them in your next comment?
dxPrintDevice.PrinterCount = ???
dxPrintDevice.PrinterIndex = ???
dxPrintDevice.DeviceMode = ???
Hi,
I have exectly the same problem.
So mainly this issue can be easyly reproduced when you set in Windows settings default printer to be printer that has status "Printer not found, unable to connect".
I have attached exception file.
Did you find any solution for this issue?
And here is a screenshot of selected default printer that provoke this issue.
Note: in case I change default printer to any other that has "online" status - the issue will not reproduce anymore. But I can't be sure that customer always has a right printer selected in Windows settings.
Any idea how to solve this issue?
Hello Vasyl,
Would you please clarify how did you manage to get this printer status? If I disable my network printer, I just get the "Offline" status for it, but this does not produce an error in the ApplyToPrintDevice method.
P.S.: Please ensure that you are using the latest version of our controls (18.1.6).
Hello Paulo,
My version of Developer Express VCL Products 17.2.3 .
So I had network printer HP LaserJet P3005dn somewhere on [UASRV06] and this printer was setup like default for my PC. Then in some day our administrato r phisicly removed this printer (due to some repairing required) and add new Canon printer instead. So, like a result, this "old" printer HP LaserJet P3005dn got status <<Printer not found on server, unable to connect>>.
Thanks, Vasyl. For now we cannot reproduce this behavior. Please try to reproduce the same behavior with the attached application. Does it also produce the error?
Hello, Paulo.
Yes, this problem is reproducing all the time even on your application when I selected printer with status <<Printer not found on server, unable to connect>>.
And no problem when normal printer selected.
Thanks, Vasyl. We cannot reproduce this behavior for now. However, we have found a place in our source code that may cause such issues in certain cases. Would you please perform a small test? Put a breakpoint into the following code line of the TdxPrinterPage.ApplyToPrintDevice method:
When the compiler stops in this line, get the dxPrnDev.dxPrintDevice.DeviceMode property value. Is it nil in your scenario?
yes, it is nil (see attched screenshot)
Thanks, Vasyl. We are working on this problem, but it may take some time to examine and trace sources.
It seems that we have found an appropriate solution. Would you please modify the dxInitPrintDevice function in the dxPrnDev.pas unit in the following manner and test the result:
function dxInitPrintDevice(ARaiseException: Boolean): Boolean; begin Result := True; try Result := (dxPrintDevice.Printers.Count > 0) and (dxPrintDevice.Handle <> 0) and (dxPrintDevice.DeviceMode <> nil); except Result := False; if ARaiseException then raise; end; end;
Hello,
As I can see, this fix is not included in the release 18.2.2
Yesterday I received a bug report from one of my customer with the stack trace leading to exactly this place. The problem appeared with his network printer was not available, and it can happen quite often with notebooks. After reconfiguration of the printer the problem disappeared.
Are there chances to see this fix in future releases?
Best regards,
Michael
Hello Michael,
You are right. This patch is not included into the 18.2.2 version of our controls. The point is that we cannot reproduce the problem on our machines. In this ticket, I have asked to test our patch, but no one responded. Would you help us test it? Modify the dxInitPrintDevice function in the dxPrnDev.pas unit as I described above, run our installer in Recompile mode, and test the result. Does this patch resolve the issue?
Hi Paulo,
Unfortunately this happened at a computer of our customer, and he fixed this by reconfiguration of the network printer BEFORE I provided him with the software based on this patch. Therefore I am in the same position as you…
I will try to play with printers a bit, but first I need to reproduce this problem. It happened in "Windows 7 Tablet PC x64 Service Pack 1 build 7601", maybe it is important.
Best wishes,
Michael
Hi Paulo,
One more update: I just received one more bug report from completely different customer with the same stack trace. In this case the software was compiled with v. 17.2.8. OS is "Windows 7 x64 Service Pack 1 build 7601".
It is interesting to admit that this issue started to appear just recently. Maybe some Microsoft update changed the way how the printers are managed?
The issue looks not reproducible with VMWare and unfortunately I have no devices with Windows 7 around. Later I will try to experiment with Windows 10 notebooks.
Best regards,
Michael
Hello, Paulo.
Sorry for this delay of response. Finally I found time to try this fix.
This modification of dxInitPrintDevice function in the dxPrnDev.pas unit made a fix for this exception.
After applying this code
Result := (dxPrintDevice.Printers.Count > 0) and (dxPrintDevice.Handle <> 0) and (dxPrintDevice.DeviceMode <> nil);
no issue anymore.Can we expect to get this fix in next release?
Thanks, Vasyl. Yes. We are planning to integrate this patch into our future builds (18.1.9 and 18.2.5).