Infinite reimporting loop

Whenever I exit play mode or edit a script the editor gets stuck in an infinite reimport loop even though nothing has changed.

Oddly this only started happening recently.

Things i’ve tried:
updated unity
turned off virus protection
deleted library folder
reimport all
used a different drive to install unity to

here’s the case number:
CASE IN-84326

Turns out it was adding a scripting define in a build profile which was causing the infinite loop.
Removing the build profile fixed it.