0

A small proportion of users are reporting an Access Violation error during startup of my FMX Windows application. I've not been able to replicate it myself, but I have determined a number of things by sending variations to the users. Here are the facts.

  • The vast majority of users do not have the issue
  • All users with the issue have what looks like a normal Windows 10 setup
  • The error occurs after the forms have been created but before the OnCreate events for each form start to get called. Perhaps somewhere early in Application.Run.
  • The error does not occur with earlier version of my app built in Delphi 10.4.
  • The error does not occur when run using Windows XP compatibility mode. This is strange since I didn't think FMX apps could run at all in Windows XP.
  • I'm using one 3rd party component (FFVCL) but another app using that component and built in Delphi 11 does not cause the error.

Does anyone know of a Delphi 11.0 issue that could be causing this? Would it help for me to upgrade to 11.2? If not, can anyone suggest ideas for further investigation? Why would some apps work when built in the same version and this one doesn't? Why would it work in Windows XP compatibility mode?

Update: After updating to Rad studio 11.2, the issue is still there for those users.

Update 2: After adding call stack logging I have determined that the error occurs in FMX.Forms TFormBorder.GetSupported. The issue may be related to custom styles, which I am using on some forms. A similar question was asked previously.

App produces an exception on target computers

I assume that the error is not happening in Windows XP compatibility mode because I had only set custom styles for Win10 and Win7. I still don't understand why this only happens for a small number of users or why this became an issue when I updated from D10 to D11.

XylemFlow
  • 963
  • 5
  • 12
  • Without seeing your code we can only wild guess. If you are unable to create [mcve] then question is not suitable for Stack Overflow. You can try asking on https://en.delphipraxis.net/ – Dalija Prasnikar Oct 24 '22 at 08:49
  • Thanks. I will do that. Of course I can't provide the full source code. Someone may have had a similar issue and know the cause from the info I've given though. – XylemFlow Oct 24 '22 at 08:51
  • Can you provide more information about this Access Violation error that is caused by your application? Do your clients that are encountering this error perhaps use computers with integrated graphics cards? I'm suspecting error might be caused by FMX not being able to create hardware accelerated rendering surface unless it is ran in WinXP compatibility mode in which case FMX might revert into software rendering mode. – SilverWarior Oct 24 '22 at 10:28
  • Have you perhaps set [GlobalUseDXInDX9Mode](https://docwiki.embarcadero.com/Libraries/Sydney/en/FMX.Types.GlobalUseDXInDX9Mode) to True? This could result in error when trying to run application on Default Win10 installation since Windows 10 by default doesn't have any DX9 libraries installed. In order to run DX9 compatible applications on Win10 you do need to install DirectX 9 separately. – SilverWarior Oct 24 '22 at 10:33
  • @SilverWarior, I don't believe this is a GPU issue. Firstly because the app works fine for the same users when built in Delphi 10.4. Their Canvas class is then the normal TCanvasD2D. I also don't believe that any of my code is responsible because the error appears to happen before any of it is reached. This seems like a D11 issue. I do plan to create a version with call stack logging to try to get more information on the error though. Secondly, another FMX app built in D11 works fine. – XylemFlow Oct 24 '22 at 14:04
  • 1
    Well when you run an application in WinXP compatibility mode this mostly affect how application windows are being rendered. Another thing that WinXP compatibility mode affects is that in WinXP compatibility mode the application is basically ran with elevated privileges in order to give application full read/write access to file system and full read/write access to system registry since WinXP did not have UAC restrictions like Windows Vista and newer do. But if UAC would be cull print here the same error should be happening with with Delphi 10.4 and Delphi 11. – SilverWarior Oct 24 '22 at 15:50
  • Other than these mentioned changes I don't know what else might be different when running application in WinXP compatibility mode. – SilverWarior Oct 24 '22 at 15:52
  • @SilverWarior, thanks. I know that there were some display related changes in D11 to support high DPI scaling and suchlike. I wonder if I should ask the users about their display setups? – XylemFlow Oct 25 '22 at 14:19

1 Answers1

1

This issue is now solved thanks to the support team at Embarcadero. The issue was happening for users who had an old version of Windows 10. The users who reported the error had not installed any Windows 10 updates in years! New DPI code added in Delphi 11 related to menu items was calling a Windows 10 function that did not exist in early versions of Windows 10 and so was causing the error. The fix was to modify line 297 of FMX.Helpers.Win.pas to the following.

if (TOSVersion.Major >= 10) and (TOSVersion.Build >= 14393) then

The issue has been reported so that it can be fixed permanently in future updates.

XylemFlow
  • 963
  • 5
  • 12