Merge pull request #1759 from vitek-karas/NativeSearchDirsFix
authorVitek Karas <vitek.karas@microsoft.com>
Fri, 17 Jan 2020 19:22:44 +0000 (11:22 -0800)
committerGitHub <noreply@github.com>
Fri, 17 Jan 2020 19:22:44 +0000 (11:22 -0800)
commit6b107a4ae4b0efb88e3e496955e30c66ccbb1405
tree0b0bfc32baab499998054a5ea462376f72f79a2c
parent643ae5ba4365da2b5385466cdeba45eaea0de530
parentc85c584b3ebf215f77f994b09490cb2f5e2074c5
Merge pull request #1759 from vitek-karas/NativeSearchDirsFix

hostfxr_get_native_search_directories must fail when given CLI command

There's no check that when running with a "command" like hostfxr_get_native_search_directories that the code will not try to locate SDK and run CLI commands.
If it happens not only it does wrong things, but the return values are bogus (it doesn't fill the output buffer).

This change adds the necessary check to avoid this completely. It also makes sure that the output buffer size is always correctly set, even on errors.

Moved all the tests for hostfxr_get_native_search_directories to use nativehost and add a test to cover this case.