From fb605c2f3dd1b442c0ba1874dbeb49b055ddcd59 Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Wed, 18 Nov 2020 16:08:03 +0000 Subject: [PATCH] Only include XML comments if assembly has a location --- .../SwaggerGenOptionsExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Boxed.AspNetCore.Swagger/SwaggerGenOptionsExtensions.cs b/Source/Boxed.AspNetCore.Swagger/SwaggerGenOptionsExtensions.cs index ec41b0a5..9bcf614a 100644 --- a/Source/Boxed.AspNetCore.Swagger/SwaggerGenOptionsExtensions.cs +++ b/Source/Boxed.AspNetCore.Swagger/SwaggerGenOptionsExtensions.cs @@ -31,8 +31,11 @@ public static SwaggerGenOptions IncludeXmlCommentsIfExists(this SwaggerGenOption throw new ArgumentNullException(nameof(assembly)); } - var filePath = Path.ChangeExtension(assembly.Location, ".xml"); - IncludeXmlCommentsIfExists(options, filePath); + if (!string.IsNullOrEmpty(assembly.Location)) + { + var filePath = Path.ChangeExtension(assembly.Location, ".xml"); + IncludeXmlCommentsIfExists(options, filePath); + } return options; }