Hi,
I would like to request a feature enhancement to add support for the "AllowUnsafeBlocks" within the "properties" section of docfx.json.
According to the documentation, the "properties" section:
Specifies an optional set of MSBuild properties used when interpreting project files. These are the same properties that are passed to MSBuild via the /property:name=value command line argument.
However, it seems that "AllowUnsafeBlocks" is currently not supported. From my understanding, adding support for this would require a small modification in the following file:
|
private static CS.CSharpParseOptions GetCSharpParseOptions(IDictionary<string, string> msbuildProperties) |
|
{ |
|
var preprocessorSymbols = (msbuildProperties.TryGetValue("DefineConstants", out var defineConstants)) |
|
? defineConstants.Split(';', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) |
|
: null; |
|
|
|
return new CS.CSharpParseOptions(preprocessorSymbols: preprocessorSymbols); |
|
} |
Here’s a minimal working example that demonstrates the issue:
namespace Test
{
public static class Program
{
public static unsafe void Main() { }
}
}
{
"metadata": [
{
"src": [{"src": "./", "files": ["Program.cs"]}],
"dest": "api",
"properties": { "AllowUnsafeBlocks": true }
}
]
}
Expected behavior:
The api documentation should generate correctly without any errors or warnings.
Current behavior:
The build fails with errors/warnings, (unless one set "allowCompilationErrors": true).
Thank you for considering this request. I believe it would be a valuable addition.
Best,
Andrzej
Hi,
I would like to request a feature enhancement to add support for the
"AllowUnsafeBlocks"within the"properties"section ofdocfx.json.According to the documentation, the
"properties"section:However, it seems that
"AllowUnsafeBlocks"is currently not supported. From my understanding, adding support for this would require a small modification in the following file:docfx/src/Docfx.Dotnet/CompilationHelper.cs
Lines 205 to 212 in 73d8279
Here’s a minimal working example that demonstrates the issue:
Program.csdocfx.json{ "metadata": [ { "src": [{"src": "./", "files": ["Program.cs"]}], "dest": "api", "properties": { "AllowUnsafeBlocks": true } } ] }Expected behavior:
The
apidocumentation should generate correctly without any errors or warnings.Current behavior:
The build fails with errors/warnings, (unless one set
"allowCompilationErrors": true).Thank you for considering this request. I believe it would be a valuable addition.
Best,
Andrzej