Repository navigation
Take $(TreatWarningsAsErrors) into account - #1224
Conversation
|
I can't remember seeing warnings from Fody for a long time now, so for me this would be OK. |
|
I regularly see the warning from PropertyChanged.Fody which says that there's an |
64d79a6 to
ef838f7
Compare
|
if we take this approach, and someone hits one of these and has msbuild treatwarningsaserrors, can they still suppress fody warnings? |
|
@SimonCropp yes, you can always set <FodyTreatWarningsAsErrors Condition="$(FodyTreatWarningsAsErrors) == ''">$(TreatWarningsAsErrors)</FodyTreatWarningsAsErrors> |
|
@SimonCropp not sure which property you're talking about, so to clarify:
|
|
in that case i have no objections. |
|
Fo some reason the integration test fails on mac after the merge. It doesn't look to be related to this PR though at first glance. 🤔 |
|
Ok, it worked on the third try ¯\_(ツ)_/¯ I noticed this PR only works for warnings emitted by the weavers though. The integration test emits a "Weavers should reference at least the current major version of Fody" warning which is not turned into an error. I suppose I should turn warnings emitted by Fody itself into errors as well (and set |
|
Regarding my previous comments:
So, everything should be fine now. I also mentioned |
|
This one bit me since we do write warnings from our weavers when weaving, but they are sometimes "unsolvable". Now the builds are failing, but will using |
|
Well, sorry about that. On my side, I wanted for people to pay attention to warnings. 😅 Are you talking about some internal weavers? I hope using |
|
Yes, just tested, that works great. I think overall this is a great improvement. We can still disable it on the few projects that cause these warnings as errors :) |
I figured maybe Fody should take
$(TreatWarningsAsErrors)into account, and emit errors instead of warnings when this property is set to true.This PR adds a
FodyTreatWarningsAsErrorsproperty which is set to$(TreatWarningsAsErrors)by default, but can be overridden if needed.This is a suggestion, tell me what you think. This could be a breaking change to existing users.
Note that the same outcome can be achieved without this PR by setting
$(MSBuildTreatWarningsAsErrors)to true - in that case any warning emitted during the build will become an error, not just Fody warnings.(sorry for all the edits, I must have pressed a shortcut and the PR got submitted before I finished writing the summary)