Recent

Author Topic: Windows Defender Delays Start of Execution  (Read 545 times)

Elap

  • Jr. Member
  • **
  • Posts: 60
Windows Defender Delays Start of Execution
« on: July 06, 2026, 02:41:32 pm »
When I compile and run a program using the FP IDE, there is a delay of a few seconds.

When I turn off Defender, there is no delay.

I have entered a folder exclusion of C:\FPC but it makes no difference.

Help!

Khrys

  • Sr. Member
  • ****
  • Posts: 470
Re: Windows Defender Delays Start of Execution
« Reply #1 on: July 06, 2026, 03:30:09 pm »
I have entered a folder exclusion of C:\FPC but it makes no difference.

What's in there? Your compiler-generated executable or the compiler itself?
You need to exclude the directory (or any parent) that contains the newly-generated  .exe  files since those change with every recompilation and thus alert the antivirus.

n7800

  • Hero Member
  • *****
  • Posts: 734
  • Lazarus IDE contributor
    • GitLab profile
Re: Windows Defender Delays Start of Execution
« Reply #2 on: July 06, 2026, 06:35:52 pm »
I haven't read it, but I remember this topic being discussed on the mailing list. Maybe there's something useful there.

You need to exclude the directory (or any parent) that contains the newly-generated  .exe  files since those change with every recompilation and thus alert the antivirus.

Yes, as far as I know, the generated EXE file for your program should be added to the exceptions (while the scan results for unchanged files should be cached). Try adding it (or the entire project folder) to the exceptions and check.

If you're talking about unsaved projects, they're saved to the temporary folder specified in the option: IDE Options > Environment > Files > Directory for building test projects. If the user's temporary folder is specified there, adding it to the antivirus exclusions is dangerous, as too many programs use it. Simply create a separate folder or subfolder.

PS: Of course, when we talk about disabling/excluding antivirus, these are just suggestions. You assume full responsibility for your actions.

Elap

  • Jr. Member
  • **
  • Posts: 60
Re: Windows Defender Delays Start of Execution
« Reply #3 on: July 06, 2026, 06:56:10 pm »
All my source code and executables are in subdirectories of C:\FPC which contains the compiler
« Last Edit: July 06, 2026, 07:03:32 pm by Elap »

Bart

  • Hero Member
  • *****
  • Posts: 5744
    • Bart en Mariska's Webstek
Re: Windows Defender Delays Start of Execution
« Reply #4 on: July 06, 2026, 09:02:33 pm »
In the end what fixed it for me was to add folders where I develop (and the fpc and Lazarus folders) as an exception to defender, but not just as a folder, but also to add those as process (like: C:\devel\*

This did not have an immediate effect, but ater some days (GOKW) it helped.
All I build with Lazarus/fpc in those folders executes immediately.

If I move some executable outside of one of those places I get the delay (up to 5 seconds) in executing.

I can PM/mail you a screenshot of how it looks.

Bart

Ten_Mile_Hike

  • Full Member
  • ***
  • Posts: 149
Re: Windows Defender Delays Start of Execution
« Reply #5 on: July 07, 2026, 03:32:17 am »
When I compile and run a program using the FP IDE, there is a delay of a few seconds.

When I turn off Defender, there is no delay.

I have entered a folder exclusion of C:\FPC but it makes no difference.

Help!
Hello,
Though this response goes beyond your immediate problem I would like to suggest
that you partition your drive to include a "Dev" drive. Dev drives have been an option
in Windows for quite a while now. Anyway; run Lazarus and all your projects including
the unsaved folder inside the Dev drive and exclude the entire drive from Defender and
all AVs'
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.

Robert A. Heinlein

Elap

  • Jr. Member
  • **
  • Posts: 60
Re: Windows Defender Delays Start of Execution
« Reply #6 on: July 07, 2026, 10:51:53 am »
Hmmm, Bart, no luck yet. Maybe I have to wait a few days!

Ok, then, please PM me a screenshot.

Jorg3000

  • Jr. Member
  • **
  • Posts: 86
Re: Windows Defender Delays Start of Execution
« Reply #7 on: July 07, 2026, 11:50:27 am »
Hi!
I have two tips for you that work in PowerShell.

Open PowerShell as an administrator: Search for “PowerShell” in the Start menu, right-click it, and select “Run as administrator.”

To check the exclusions list:
Code: Pascal  [Select][+][-]
  1. Get-MpPreference | Select-Object -ExpandProperty ExclusionPath

Second, you can create a test file in your exclusion folder (or better, in your project target folder) to check whether Defender detects the file as a virus, or if your folder exclusion is working.

It's called an EICAR Anti-Virus Test File ... https://en.wikipedia.org/wiki/EICAR_test_file

You can create the test file via PowerShell as follows:
Code: Pascal  [Select][+][-]
  1. Set-Content -Path "C:\MyProject\eicar-test.com" -Value 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'

As a cross-check, you can also create a test file outside of an exclusion folder.

Jörg

loaded

  • Hero Member
  • *****
  • Posts: 880
Re: Windows Defender Delays Start of Execution
« Reply #8 on: July 07, 2026, 12:59:21 pm »
Depending on the Lazarus version you're using and your 32-bit or 64-bit build method, you need to add the executable applications to the Defender exclusions. The example shows the Lazarus version I'm using and the applications it runs on the 32-bit build. You can verify this using the "Process Explorer" application.

And of course, the default application, project1.exe.

After that, I hope you'll see a noticeable speed increase.👍
The more memory computers have, the less memory people seem to use. 😅

 

TinyPortal © 2005-2018