Skip to content

Commit 233b49a

Browse files
authored
Merge pull request #693 from mono/develop
keep the latest inheritdoc only
2 parents f0bee06 + 4c8d8a3 commit 233b49a

12 files changed

+90
-4
lines changed

Diff for: Documentation/how-to-debug/how-to-debug-mdoc.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
## Introduction
2+
3+
### Input
4+
5+
The input of mdoc is `dll`,`winmd` or `exe` which are organized in below folder structure.
6+
7+
```
8+
|_dependencies
9+
| |_version1
10+
| |-A.dependent.dll
11+
| |-B.dependent.dll
12+
|_version1
13+
|-A.dll
14+
|_B.dll
15+
```
16+
In current production pipeline, not all the source repos have binaries in it. Some are the NuGet packages registered in csv file.
17+
18+
Example sources:
19+
1. [binaries](https://apidrop.visualstudio.com/_git/binaries)
20+
2. [mrefconfig](https://apidrop.visualstudio.com/binaries/_git/mrefconfig?path=/bundlepackages)
21+
3. [content repo](https://github.com/Azure/azure-docs-sdk-dotnet/tree/main/bundlepackages)
22+
23+
We may not always be able to use the source repo as the input so the best way is to download the pipeline artifact to local to debug.
24+
![Pipeline](./images/pipeline.png)
25+
![Artifact](./images/artifact.png)
26+
27+
### Commands
28+
29+
There are 2 commands used in current production pipelines.
30+
31+
1. fx-bootstrap: generate `frameworks.xml` to the output folder
32+
```dotnetcli
33+
fx-bootstrap -fx {frameworks output folder} -importContent {true/false}
34+
```
35+
2. update: generate ECMAXMLs to the output folder
36+
```dotnetcli
37+
update -o {mdoc output folder} -fx {frameworks path} --debug -index false -lang docid -lang vb.net -lang fsharp -L "C:\Program Files (x86)\Windows Kits\10\References" -L "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\msdatasrc.dll" -L "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\PublicAssemblies" -L "C:\Program Files\dotnet" --delete
38+
```
39+
40+
### Debug steps
41+
1. Clone https://github.com/mono/api-doc-tools repo to local.
42+
2. Open it in Visual Studio and make sure it is built successfully.
43+
3. Set `mdoc` as the startup project.
44+
4. Prepare the input folder in local disk.
45+
![Input foldler](./images/input-folder.png)
46+
5. Create two launch profiles, one for `fx-bootstrap` and one for `update`.
47+
![Lanuch profile1](./images/lanuch-profile1.png)
48+
![Lanuch profile2](./images/lanuch-profile2.png)
49+
6. Locate the problematic piece of code.
50+
7. Set a breakpoint and start to debug.
51+
52+
## Example
53+
1. Partner reported a bug: https://ceapex.visualstudio.com/Engineering/_workitems/edit/896871
54+
2. Analysis the bug and identify this is a mdoc issue.
55+
3. Located the impacted .NET content repo: [dotnet-api-docs](https://github.com/dotnet/dotnet-api-docs).
56+
4. Find the corresponding pipeline in the commit log. https://apidrop.visualstudio.com/Content%20CI/_build/results?buildId=422059&view=results
57+
![Commit Log](./images/commit-log.png)
58+
5. Since the source is not NuGet source, we can pull the source repo as our input.
59+
6. Go to `Run .NET CI Script` step and find the source repo in the `paramsJson`
60+
```
61+
"https://apidrop.visualstudio.com/_git/binaries","branch":"master","folder":"dotnet"
62+
```
63+
7. Clone the source repo to local.
64+
8. Select `fx-bootstrap` launch profile and run.
65+
```dotnetcli
66+
fx-bootstrap -fx "{local path}\binaries\dotnet"
67+
```
68+
9. The entry class of mdoc is [mdoc.cs](https://github.com/mono/api-doc-tools/blob/main/mdoc/Mono.Documentation/mdoc.cs) and the update command is in [MDocUpdater.cs](https://github.com/mono/api-doc-tools/blob/main/mdoc/Mono.Documentation/MDocUpdater.cs).
69+
10. After analyzing the bug, you may want to set a breakpoint at:
70+
![breakpoint](./images/breakpoint.png)
71+
11. Select `update` launch profile and start to debug.
72+
73+
## Tips
74+
1. If you want to debug against a specific .dll, you can modify this line of [MDocUpdater.cs](https://github.com/mono/api-doc-tools/blob/f0bee064c5e018b82a39ec36a4c59d474fb154f9/mdoc/Mono.Documentation/MDocUpdater.cs#L367)
75+
76+
From
77+
```
78+
var assemblyFiles = filters.Split('|').SelectMany(v => Directory.GetFiles(path, v));
79+
```
80+
To
81+
```
82+
var assemblyFiles = filters.Split('|').SelectMany(v => Directory.GetFiles(path, v)).Where(x => x.Contains("name-of-dll"));
83+
```

Diff for: Documentation/how-to-debug/images/artifact.png

83.7 KB
Loading

Diff for: Documentation/how-to-debug/images/breakpoint.png

145 KB
Loading

Diff for: Documentation/how-to-debug/images/commit-log.png

45.5 KB
Loading

Diff for: Documentation/how-to-debug/images/input-folder.png

26.2 KB
Loading
25.9 KB
Loading
42.8 KB
Loading

Diff for: Documentation/how-to-debug/images/pipeline.png

102 KB
Loading

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,6 @@ make prepare all check
8282
```
8383

8484
Please review [mono's installation guide](http://www.mono-project.com/download/#download-lin) if you are using a different flavor of linux.
85+
86+
## How to debug
87+
[How to debug mdoc](./Documentation/how-to-debug/how-to-debug-mdoc.md)

Diff for: mdoc/Consts.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace Mono.Documentation
33
{
44
public static class Consts
55
{
6-
public static string MonoVersion = "5.9.3";
6+
public static string MonoVersion = "5.9.3.1";
77
public const string DocId = "DocId";
88
public const string CppCli = "C++ CLI";
99
public const string CppCx = "C++ CX";

Diff for: mdoc/Mono.Documentation/Updater/MsxdocDocumentationImporter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public override void ImportDocumentation (DocsNodeInfo info)
7373
if (DocUtils.NeedsOverwrite(e["returns"]))
7474
MDocUpdater.ClearElement(e, "returns");
7575
}
76-
77-
76+
if (elem.SelectSingleNode("inheritdoc") != null)
77+
MDocUpdater.ClearElement(e, "inheritdoc");
7878

7979
foreach (XmlNode child in elem.ChildNodes)
8080
{

Diff for: mdoc/mdoc.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>mdoc</id>
5-
<version>5.9.3</version>
5+
<version>5.9.3.1</version>
66
<title>mdoc</title>
77
<authors>Microsoft</authors>
88
<owners>Microsoft</owners>

0 commit comments

Comments
 (0)