Skip to content

chore: Modify windows defender settings on CI#2974

Merged
timcassell merged 1 commit intodotnet:masterfrom
filzrev:chore-modify-windowsdefender-settings
Jan 20, 2026
Merged

chore: Modify windows defender settings on CI#2974
timcassell merged 1 commit intodotnet:masterfrom
filzrev:chore-modify-windowsdefender-settings

Conversation

@filzrev
Copy link
Copy Markdown
Contributor

@filzrev filzrev commented Jan 20, 2026

On Windows CI environment.
Set-MpPreference -DisableRealtimeMonitoring $true command sometimes failed with following error.
(e.g. https://github.com/dotnet/BenchmarkDotNet/actions/runs/21105743318/job/60696964630)

Set-MpPreference : Operation failed with the following error: 0x800106ba. Operation: Set-MpPreference. Target: 
DisableRealtimeMonitoring.
At C:\a\_temp\59c177be-e82b-4480-9398-c47727230783.ps1:2 char:1
+ Set-MpPreference -DisableRealtimeMonitoring $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_MpPreference:root\Microsoft\...FT_MpPreference) [Set-MpPreference],  
   CimException
    + FullyQualifiedErrorId : HRESULT 0x800106ba,Set-MpPreference

It seems there is some race conditions that can't disable Windows Defender.

What's changed in this PR

  1. Remove code that disabling Windows Defender.
  2. Add following exclude path settings instead.
    2.1. $env:GITHUB_WORKSPACE
    2.2. $env:Temp

I though this approach is less likely to fail than DisableRealtimeMonitoring.

If it failed with this PR settings.
It need to add retry logics to wait Windows Defender service is available.

@timcassell timcassell merged commit b956aed into dotnet:master Jan 20, 2026
11 checks passed
@timcassell timcassell added this to the v0.16.0 milestone Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants