fsprojects / FAKE

FAKE - F# Make
https://fake.build
Other
1.28k stars 585 forks source link

`StringBuilder.appendQuotedIfNotNull` is used incorrectly. #2728

Open teo-tsirpanis opened 1 year ago

teo-tsirpanis commented 1 year ago

In https://github.com/fsprojects/FAKE/blob/8dbf221729c40be34a2907fcf49a707c029a752b/src/app/Fake.Core.String/StringBuilder.fs#L69-L75 we are appending nothing if value is null, but if it isn't we append both s and value.

This doesn't work well with code like https://github.com/fsprojects/FAKE/blob/8dbf221729c40be34a2907fcf49a707c029a752b/src/app/Fake.DotNet.MSBuild/MSBuild.fs#L684-L687

value is Some, which is a function, and displaying does not make any sense, leading to errors like https://ci.appveyor.com/project/teo-tsirpanis/farkle/builds/45896483/job/9et0xrw72ibtg3ar#L6292.

yazeedobaid commented 1 year ago

@teo-tsirpanis thanks for reporting, can you send a PR?

teo-tsirpanis commented 1 year ago

I can't understand what the correct code would be. I would have already sent it if I could. 😅

teo-tsirpanis commented 1 year ago

@yazeedobaid I want to fix the bug, can you help me understand it? What should appendQuotedIfNotNull do?

yazeedobaid commented 1 year ago

@teo-tsirpanis the function should escape quotations in the passed string if it has any. It is being discussed in this PR https://github.com/fsprojects/FAKE/pull/2739