[Bug] Exception while trying to parse <code> XML tags with source field defined.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 890
- Avg merge
- 2h 11m
- Merged PRs (30d)
- 10
Description
**Describe the bug**
I have a function with a `` tag like so:
```csharp
///
/// ...
///
///
DataStoreGetVariableRequest GetVariable(string key, object defaultValue);
```
When consuming the api `docfx metadata docfx.json` I get the following exception in the console:
```c
ArgumentNullException: Value cannot be null. (Parameter 'path1')
at void Throw(string paramName)
at string Combine(string path1, string path2)
at string g__ResolveCode|1(string source) in
SymbolVisitorAdapter.cs:722
//etc
```
Which refers to this line:
```csharp
//src/Docfx.Dotnet/ManagedReference/Visitors/SymbolVisitorAdapter.cs/ln722
var basePath = _config.CodeSourceBasePath ?? (
item.Source?.Path is { } sourcePath
? Path.GetDirectoryName(Path.GetFullPath(Path.Combine(EnvironmentContext.BaseDirectory, sourcePath)))
: null);
```
Aka `EnvironmentContext.BaseDirector == null`. But......
```csharp
//src/Docfx.Plugins/EnvironmentContext.cs
public static string BaseDirectory => string.IsNullOrEmpty(_baseDirectory) ? "." : _baseDirectory;
```
It shouldn't be possible to be null???
Is this a bug? or do I have something setup wrong?
---
**To Reproduce**
Steps to reproduce the behavior:
1. I guess just try building a project with code tags? Idk this seems like such a core issue I assume its something on my end.
**Expected behavior**
No exception when reading tags
**Context (please complete the following information):**
- OS: MacOS
- Docfx version: 2.75.2
**Extra Context**
Issue only happens when `source` is defined. `` has no issue.
Contributor guide
Assessment
This issue has not been assessed yet.