Skip to content

Commit 87dd422

Browse files
authored
Merge pull request #4596 from dotnet/docs-build-v3
Enable Docfx V3
2 parents e4292c7 + 80ac8b9 commit 87dd422

File tree

2 files changed

+88
-40
lines changed

2 files changed

+88
-40
lines changed

.openpublishing.publish.config.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"build_source_folder": ".",
66
"build_output_subfolder": ".",
77
"locale": "en-us",
8-
"xref_query_tags": ["/uwp/api"],
8+
"xref_query_tags": [
9+
"/uwp/api"
10+
],
911
"monikers": [],
1012
"moniker_ranges": [],
1113
"open_to_public_contributors": true,
@@ -90,5 +92,8 @@
9092
"target_framework": "net45",
9193
"version": "latest"
9294
}
93-
]
95+
],
96+
"docs_build_engine": {
97+
"name": "docfx_v3"
98+
}
9499
}
Lines changed: 81 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,90 @@
1-
using System;
1+
using System;
2+
23
using System.Runtime.InteropServices;
3-
namespace Testing
4-
{
5-
class Class1
4+
namespace Testing
5+
6+
{
7+
8+
class Class1
9+
610
{
7-
// <snippet1>
8-
[StructLayout(LayoutKind.Sequential)]
9-
public class INNER
10-
{
11-
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
11+
// <snippet1>
12+
13+
[StructLayout(LayoutKind.Sequential)]
14+
15+
public class INNER
16+
17+
{
18+
19+
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
20+
1221
public string field1 = "Test";
13-
}
14-
[StructLayout(LayoutKind.Sequential)]
15-
public struct OUTER
16-
{
17-
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
18-
public string field1;
19-
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)]
20-
public byte[] inner; }
21-
[DllImport(@"SomeTestDLL.dll")]
22+
}
23+
24+
[StructLayout(LayoutKind.Sequential)]
25+
26+
public struct OUTER
27+
28+
{
29+
30+
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
31+
32+
public string field1;
33+
34+
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)]
35+
36+
public byte[] inner;
37+
}
38+
[DllImport(@"SomeTestDLL.dll")]
39+
2240
public static extern void CallTest( ref OUTER po);
23-
static void Main(string[] args)
24-
{
25-
OUTER ed = new OUTER();
26-
INNER[] inn=new INNER[10];
27-
INNER test = new INNER();
41+
static void Main(string[] args)
42+
43+
{
44+
45+
OUTER ed = new OUTER();
46+
47+
INNER[] inn=new INNER[10];
48+
49+
INNER test = new INNER();
50+
2851
int iStructSize = Marshal.SizeOf(test);
29-
int sz =inn.Length * iStructSize;
52+
int sz =inn.Length * iStructSize;
53+
3054
ed.inner = new byte[sz];
31-
try
32-
{
33-
CallTest( ref ed); }
34-
catch(Exception e)
35-
{
36-
Console.WriteLine(e.Message); }
37-
IntPtr buffer = Marshal.AllocCoTaskMem(iStructSize*10);
55+
try
56+
57+
{
58+
59+
CallTest( ref ed);
60+
}
61+
62+
catch(Exception e)
63+
64+
{
65+
66+
Console.WriteLine(e.Message);
67+
}
68+
69+
IntPtr buffer = Marshal.AllocCoTaskMem(iStructSize*10);
70+
3871
Marshal.Copy(ed.inner,0,buffer,iStructSize*10);
39-
int iCurOffset = 0;
40-
for(int i=0;i<10;i++)
72+
int iCurOffset = 0;
73+
74+
for(int i=0;i<10;i++)
75+
4176
{
4277
inn[i] = (INNER)Marshal.PtrToStructure(new
43-
IntPtr(buffer.ToInt32()+iCurOffset),typeof(INNER) );
44-
iCurOffset += iStructSize; }
45-
Console.WriteLine(ed.field1);
46-
Marshal.FreeCoTaskMem(buffer); }
47-
// </snippet1> }}
78+
IntPtr(buffer.ToInt32()+iCurOffset),typeof(INNER) );
79+
80+
iCurOffset += iStructSize;
81+
}
82+
83+
Console.WriteLine(ed.field1);
84+
85+
Marshal.FreeCoTaskMem(buffer);
86+
}
87+
// </snippet1>
88+
}
89+
}
90+

0 commit comments

Comments
 (0)