vbfox / FoxSharp

Repository of small F# 🦊 utilities, mainly for using with FAKE
MIT License
31 stars 3 forks source link

VsInstances.getAll crashes with NullReferenceException #5

Closed inosik closed 6 years ago

inosik commented 6 years ago

I debugged the latest code and for some reason ISetupErrorState.GetSkippedPackages returns null, which then crashes in the enumerator inside of List.ofSeq. This is the code:

https://github.com/vbfox/FoxSharp/blob/e35df052479f37ec6f6a984d2948be3765f5c17f/src/BlackFox.VsWhere/VsInstances.fs#L49

This is pretty critical because the VsWhere package is used by FAKE now and the build fails with the infamous TypeInitializationException.

vbfox commented 6 years ago

Interesting, i'll trust you on the null result and harden all members of ISetupErrorState as it would require me to break one of my VS instances to test in exactly the same way as yours. This part of the code is only hit if some VS instance is in an error state.

vbfox commented 6 years ago

Fix released in 0.3.2 with additional hardening done by ignoring instances that throw an exception during parsing.

inosik commented 6 years ago

Thanks for fixing this! Now I can update my FAKE scripts.

it would require me to break one of my VS instances to test in exactly the same way as yours.

The other method, GetFailedPackages returns a proper array with an element in it, because my VS 2017 setup fails to install the Blend SDK (I guess because it was already installed with VS 2013). But I'm not sure what GetSkippedPackages should return and how these two affect each other.

vbfox commented 6 years ago

I think skipped packages are dependent packages that weren't considered because their dependency failed. Like if Blend depended on Blend SDK and the SDK failed Blend itself would be marked as skipped.

BTW I'm not sure this install would be looked at by FAKE code as I implemented it as it only look for completed installations and a failed package would invalidate that. Shouldn't cause problems as there are quite a few fallback searches beyond VS installs that should find things just fine.