-
-
Notifications
You must be signed in to change notification settings - Fork 20.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Fix MSBuild logger exception thrown when processing a warning or an error with no associated file #96127
[3.x] Fix MSBuild logger exception thrown when processing a warning or an error with no associated file #96127
Conversation
Thanks for contributing to the .NET module! I'd like to understand better what this PR is fixing. Can you provide a minimal reproduction project? How does the CSV file look like when the issue takes place? |
Here you go: https://github.com/RedOrbweaver/cstest/tree/msbuild_parser_test You may need to run What's happening is that if MSBuild outputs a warning or an error with There's a second bug in the error/warning panel that causes the editor to crash when clicking on the file-less warning. I also added a few extra nullchecks, as at this point I don't think any fields in BuildErrorEventArgs can be safely assumed to be non-null. Here's the build output for Godot 3.5.3:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is the warning that I get with your MRP:
(0,0): warning FodyPackageReference: Fody: The package reference for PropertyChanged.Fody does not contain PrivateAssets='All'
The error has no associated file, so e.File
is null. The changes to handle a null e.File
in the logger look good to me, the other changes should not be needed.
The issue is also present in Godot 4, so this change needs to be applied to master
. If you are unable to open a PR against the master
branch, I can do it for you.
modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs
Outdated
Show resolved
Hide resolved
modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
Outdated
Show resolved
Hide resolved
modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
Outdated
Show resolved
Hide resolved
5f66671
to
d52e604
Compare
Should be fine now, I'll port it to Godot 4 once it's approved. |
modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
Outdated
Show resolved
Hide resolved
edf5156
to
5885cfa
Compare
That's... Weird. It doesn't do it in any other project and it's not how I'd configure it anyway. Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
By the way, it seems your commit is not linked to your GitHub account. See: Why are my commits linked to the wrong user? for more info.
This seems to be related to capitalization being different in the email for the 3.x and 4.x PR. Would be good to see if @RedOrbweaver wants to change this before merging. |
…not refer to any file
5885cfa
to
5cbe7fd
Compare
I think I fixed it. Weird that it'd care about capitalization, AFAIK neither capitalization nor dots matter in email resolution. |
Thanks! |
I was trying to get Fody (specifically PropertyChanged.Fody) to work with my project. When the Fody package would throw an error or a warning the logger would encounter an exception and fail the build. Actually, the build would succeed, but editor would throw an error. Pressing build again would find that all files have been generated and launch the program normally. You can imagine how insane that made me feel.
The issue was that the warning/error parsing code did not account for the possibility of the
BuildErrorEventArgs.File
field being null. I also found thatBuildOutputView
would crash the entire editor when clicking on any entry without a related file, so I fixed that too (changing one&&
to||
did the trick). I couldn't get the debugger to work with the C# glue, so I added a few extra null-checks just in case there are other edge cases I missed.Side note: In case someone finds this by googling
"Fody" + "Godot"
, the way I was able to get it to work was by enabling the addons inside a<WeaverConfiguration><Weavers><Weavers /><WeaverConfiguration />
tag directly in the.csproj
file. Don't bother with aFodyWeavers.xml
file, it will only bring you confusion and pain. Also remember to setPrivateAssets
toall
for all NuGet packages (including Fody itself) like this: