1

I'm trying to run a project that has an older version of NET Core (2.2) on my Mac and it throws this error:

System.IO.FileNotFoundException: Could not find file '[path of the project]/bin/Debug/netcoreapp2.2/\[Documentation XML file]'.
File name: '[path of the project]/bin/Debug/netcoreapp2.2/\[Documentation XML file]'
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.OpenUrl()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space)
   at System.Xml.XPath.XPathDocument..ctor(String uri, XmlSpace space)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions.<>c__DisplayClass25_0.<IncludeXmlComments>b__0()
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions.CreateSwaggerProvider(IServiceProvider serviceProvider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
   at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.<UseMiddleware>b__0(RequestDelegate next)
   at Microsoft.AspNetCore.Builder.Internal.ApplicationBuilder.Build()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

The XML documentation file exists inside the main folder and actually, it is generated when I try to compile and debug on my browser, but it keeps throwing this error.

Any ideas?

Zechworld
  • 11
  • 3
  • In your path, ` \\` should probably be `/`. You may consider using [System.IO.Path.Combine](https://learn.microsoft.com/en-us/dotnet/api/system.io.path.combine?view=net-7.0). – Tu deschizi eu inchid Oct 08 '22 at 19:47
  • 1
    Is following defined? [path of the project] – jdweng Oct 08 '22 at 19:55
  • Can your show the path you defined in your project? – Xinran Shen Oct 10 '22 at 02:17
  • The path is `/Users/Zech/workspace/[My company]/projects/Ris/[Backend folder]/[Company Name].Nexus.Inpatient/bin/Debug/netcoreapp2.2/\[Company Name].Nexus.Inpatient.XML`. **That \ seems very odd to me as well** . I replaced some names inside the [ ] because in my company they are pretty strict with the information they allow to share. (I'm running the project on macOS) – Zechworld Oct 11 '22 at 11:56
  • This [post](https://stackoverflow.com/questions/49398965/what-is-the-equivalent-of-server-mappath-in-asp-net-core) may be useful. – Tu deschizi eu inchid Oct 11 '22 at 14:00
  • Thanks for your help ! I got a hunch about my Startup file due to the Dependency Injection lines in the error, I've found the weird **\** inside a Swagger config so I changed that line to the normal **/** and worked – Zechworld Oct 11 '22 at 23:31

0 Answers0