Found out the hard way just leaving this here for anybody that encounters this.
DO NOT USE CONDITIONS FOR COMPILATION IN YOUR csproj FILE!
Stuff like for example:
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
And then properties for those to use later for compiler:
<PropertyGroup Condition="'$(IsWindows)'=='true'">
<DefineConstants>_WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(IsLinux)'=='true'">
<DefineConstants>_LINUX</DefineConstants>
</PropertyGroup>
Godot doesn’t like this at all and it will brick your project! The symptoms of this look like it has nothing to do with it. You don’t see any issues at first. The project still compiles and runs fine. But you’ll see issues like unable to set any exported field in the editor or even see any of them set to anything you’ve set them to before.
Went through a huge PITA because of this.
Avoid doing this at all cost. I guess for detecting OS use the appropriate Godot object at runtime not during compilation. Or find other ways of avoiding compilation conditions.