Skip to content

Commit f6cbff7

Browse files
authored
ConsoleApp: Validate not existing or badly formed entries in asmpath (i.e. --asmpath "C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.18\" is not correctly identifies, it should be --asmpath "C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.18") (#360)
1 parent cdb0c47 commit f6cbff7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/dscom.client/Program.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ private static void ConfigureRegisterAssemblyHandler(Command registerCommand)
178178
{
179179
try
180180
{
181+
foreach (var asmPath in options.ASMPath)
182+
{
183+
if (!Directory.Exists(asmPath))
184+
{
185+
throw new DirectoryNotFoundException($"Directory {asmPath} not found.");
186+
}
187+
}
181188
var paths = options.ASMPath.Append(Path.GetDirectoryName(options.TargetAssembly)).ToArray();
182189

183190
using var assemblyResolver = new AssemblyResolver(paths!, false);
@@ -279,6 +286,14 @@ private static void ExportTypeLibraryImpl(TypeLibConverterOptions options, out W
279286
var dir = Path.GetDirectoryName(options.Assembly);
280287

281288
var asmPaths = options.ASMPath;
289+
foreach (var asmPath in asmPaths)
290+
{
291+
if (!Directory.Exists(asmPath))
292+
{
293+
throw new DirectoryNotFoundException($"Directory {asmPath} not found.");
294+
}
295+
}
296+
282297
if (Directory.Exists(dir))
283298
{
284299
asmPaths = asmPaths.Prepend(dir).ToArray();

0 commit comments

Comments
 (0)