Game runs fine in editor but crashes on build

This is no doubt caused by my code but there's no error messages in unity or visual studios and it makes debugging practically impossible.

The player crash logs says something about function name not accessible :

0x00007FF82AA2632A (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF82AD7A957)

which is not very helpful.

Please improve your entities debugging tools.

EDIT: Turns out unity broke the resources folder and addressables loading
CASE IN-23345

This is a really weird bug.
I can get my build to run by changing the length of my scripts.
Adding or removing a few lines of code can make it work for one scene but not in others.
There's no script errors and it works fine in the editor.
The player crash happens straight away before instantiating anything.