Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Paket.Core/BindingRedirects.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ let internal setRedirect (doc:XDocument) bindingRedirect =

/// Applies a set of binding redirects to a single configuration file.
let private applyBindingRedirects bindingRedirects (configFilePath:string) =
let config = XDocument.Load(configFilePath, LoadOptions.PreserveWhitespace)
let config =
try
XDocument.Load(configFilePath, LoadOptions.PreserveWhitespace)
with
| :? System.Xml.XmlException as ex ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens with other exceptions?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As usual: Paket just terminates. :-)
But this won't fix it, exception is re-thrown.

I think this is good info for non-verbose also: Code won't do anything in happy case scenario.

printfn "Illegal xml in file: %s" configFilePath

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please use verbosefn

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test this code: Put some empty App.config file to your project and try to convert from nuget to paket.

raise ex

let config = Seq.fold setRedirect config bindingRedirects
config.Save configFilePath

Expand Down