Skip to content

Commit b05727a

Browse files
committed
Extra info added
1 parent d3ad7d0 commit b05727a

File tree

10 files changed

+496
-15
lines changed

10 files changed

+496
-15
lines changed

Src/Basic.Reference.Assemblies.Net461/Basic.Reference.Assemblies.Net461.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
10+
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
1011
</ItemGroup>
1112

1213
<Import Project="Generated.targets" />

Src/Basic.Reference.Assemblies.Net461/Generated.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,74 @@
77
using Microsoft.CodeAnalysis;
88

99
namespace Basic.Reference.Assemblies;
10+
public static partial class Net461
11+
{
12+
public static class ExtraReferenceInfos
13+
{
14+
15+
/// <summary>
16+
/// The <see cref="ReferenceInfo"/> for System.Threading.Tasks.Extensions.dll
17+
/// </summary>
18+
public static ReferenceInfo SystemThreadingTasksExtensions => new ReferenceInfo("System.Threading.Tasks.Extensions.dll", Resources.SystemThreadingTasksExtensions, Net461.ExtraReferences.SystemThreadingTasksExtensions, global::System.Guid.Parse("bc890e4e-a34f-463c-8fd9-60f43c8beb88"));
19+
private static ImmutableArray<ReferenceInfo> _all;
20+
public static ImmutableArray<ReferenceInfo> All
21+
{
22+
get
23+
{
24+
if (_all.IsDefault)
25+
{
26+
_all =
27+
[
28+
SystemThreadingTasksExtensions,
29+
];
30+
}
31+
return _all;
32+
}
33+
}
34+
35+
public static IEnumerable<(string FileName, byte[] ImageBytes, PortableExecutableReference Reference, Guid Mvid)> AllValues => All.Select(x => x.AsTuple());
36+
}
37+
}
38+
39+
public static partial class Net461
40+
{
41+
public static class ExtraReferences
42+
{
43+
private static PortableExecutableReference? _SystemThreadingTasksExtensions;
44+
45+
/// <summary>
46+
/// The <see cref="PortableExecutableReference"/> for System.Threading.Tasks.Extensions.dll
47+
/// </summary>
48+
public static PortableExecutableReference SystemThreadingTasksExtensions
49+
{
50+
get
51+
{
52+
if (_SystemThreadingTasksExtensions is null)
53+
{
54+
_SystemThreadingTasksExtensions = AssemblyMetadata.CreateFromImage(Resources.SystemThreadingTasksExtensions).GetReference(filePath: "System.Threading.Tasks.Extensions.dll", display: "System.Threading.Tasks.Extensions (net461)");
55+
}
56+
return _SystemThreadingTasksExtensions;
57+
}
58+
}
59+
60+
private static ImmutableArray<PortableExecutableReference> _all;
61+
public static ImmutableArray<PortableExecutableReference> All
62+
{
63+
get
64+
{
65+
if (_all.IsDefault)
66+
{
67+
_all =
68+
[
69+
SystemThreadingTasksExtensions,
70+
];
71+
}
72+
return _all;
73+
}
74+
}
75+
}
76+
}
77+
1078
public static partial class Net461
1179
{
1280
public static class Resources
@@ -1115,6 +1183,12 @@ public static class Resources
11151183
public static byte[] SystemXmlXmlSerializer => ResourceLoader.GetOrCreateResource(ref _SystemXmlXmlSerializer, "net461.System.Xml.XmlSerializer");
11161184
private static byte[]? _SystemXmlXmlSerializer;
11171185

1186+
/// <summary>
1187+
/// The image bytes for System.Threading.Tasks.Extensions.dll
1188+
/// </summary>
1189+
public static byte[] SystemThreadingTasksExtensions => ResourceLoader.GetOrCreateResource(ref _SystemThreadingTasksExtensions, "net461.System.Threading.Tasks.Extensions");
1190+
private static byte[]? _SystemThreadingTasksExtensions;
1191+
11181192

11191193
}
11201194
}

Src/Basic.Reference.Assemblies.Net461/Generated.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,5 +736,9 @@
736736
<LogicalName>net461.System.Xml.XmlSerializer</LogicalName>
737737
<Link>Resources\net461\System.Xml.XmlSerializer.dll</Link>
738738
</EmbeddedResource>
739+
<EmbeddedResource Include="$(NuGetPackageRoot)\system.threading.tasks.extensions\4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll" WithCulture="false">
740+
<LogicalName>net461.System.Threading.Tasks.Extensions</LogicalName>
741+
<Link>Resources\net461\System.Threading.Tasks.Extensions.dll</Link>
742+
</EmbeddedResource>
739743
</ItemGroup>
740744
</Project>

Src/Basic.Reference.Assemblies.NetStandard20/Basic.Reference.Assemblies.NetStandard20.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
10+
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
11+
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
1012
</ItemGroup>
1113

1214
<Import Project="Generated.targets" />

Src/Basic.Reference.Assemblies.NetStandard20/Generated.cs

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,122 @@
77
using Microsoft.CodeAnalysis;
88

99
namespace Basic.Reference.Assemblies;
10+
public static partial class NetStandard20
11+
{
12+
public static class ExtraReferenceInfos
13+
{
14+
15+
/// <summary>
16+
/// The <see cref="ReferenceInfo"/> for Microsoft.CSharp.dll
17+
/// </summary>
18+
public static ReferenceInfo MicrosoftCSharp => new ReferenceInfo("Microsoft.CSharp.dll", Resources.MicrosoftCSharp, NetStandard20.ExtraReferences.MicrosoftCSharp, global::System.Guid.Parse("481b904b-3433-4e80-b896-766a3cc8e857"));
19+
20+
/// <summary>
21+
/// The <see cref="ReferenceInfo"/> for Microsoft.VisualBasic.dll
22+
/// </summary>
23+
public static ReferenceInfo MicrosoftVisualBasic => new ReferenceInfo("Microsoft.VisualBasic.dll", Resources.MicrosoftVisualBasic, NetStandard20.ExtraReferences.MicrosoftVisualBasic, global::System.Guid.Parse("b61ee3c6-71d0-4726-931a-fa448a2e8f0e"));
24+
25+
/// <summary>
26+
/// The <see cref="ReferenceInfo"/> for System.Threading.Tasks.Extensions.dll
27+
/// </summary>
28+
public static ReferenceInfo SystemThreadingTasksExtensions => new ReferenceInfo("System.Threading.Tasks.Extensions.dll", Resources.SystemThreadingTasksExtensions, NetStandard20.ExtraReferences.SystemThreadingTasksExtensions, global::System.Guid.Parse("619062a8-972f-4ae5-bbee-e36ac541d14f"));
29+
private static ImmutableArray<ReferenceInfo> _all;
30+
public static ImmutableArray<ReferenceInfo> All
31+
{
32+
get
33+
{
34+
if (_all.IsDefault)
35+
{
36+
_all =
37+
[
38+
MicrosoftCSharp,
39+
MicrosoftVisualBasic,
40+
SystemThreadingTasksExtensions,
41+
];
42+
}
43+
return _all;
44+
}
45+
}
46+
47+
public static IEnumerable<(string FileName, byte[] ImageBytes, PortableExecutableReference Reference, Guid Mvid)> AllValues => All.Select(x => x.AsTuple());
48+
}
49+
}
50+
51+
public static partial class NetStandard20
52+
{
53+
public static class ExtraReferences
54+
{
55+
private static PortableExecutableReference? _MicrosoftCSharp;
56+
57+
/// <summary>
58+
/// The <see cref="PortableExecutableReference"/> for Microsoft.CSharp.dll
59+
/// </summary>
60+
public static PortableExecutableReference MicrosoftCSharp
61+
{
62+
get
63+
{
64+
if (_MicrosoftCSharp is null)
65+
{
66+
_MicrosoftCSharp = AssemblyMetadata.CreateFromImage(Resources.MicrosoftCSharp).GetReference(filePath: "Microsoft.CSharp.dll", display: "Microsoft.CSharp (netstandard20)");
67+
}
68+
return _MicrosoftCSharp;
69+
}
70+
}
71+
72+
private static PortableExecutableReference? _MicrosoftVisualBasic;
73+
74+
/// <summary>
75+
/// The <see cref="PortableExecutableReference"/> for Microsoft.VisualBasic.dll
76+
/// </summary>
77+
public static PortableExecutableReference MicrosoftVisualBasic
78+
{
79+
get
80+
{
81+
if (_MicrosoftVisualBasic is null)
82+
{
83+
_MicrosoftVisualBasic = AssemblyMetadata.CreateFromImage(Resources.MicrosoftVisualBasic).GetReference(filePath: "Microsoft.VisualBasic.dll", display: "Microsoft.VisualBasic (netstandard20)");
84+
}
85+
return _MicrosoftVisualBasic;
86+
}
87+
}
88+
89+
private static PortableExecutableReference? _SystemThreadingTasksExtensions;
90+
91+
/// <summary>
92+
/// The <see cref="PortableExecutableReference"/> for System.Threading.Tasks.Extensions.dll
93+
/// </summary>
94+
public static PortableExecutableReference SystemThreadingTasksExtensions
95+
{
96+
get
97+
{
98+
if (_SystemThreadingTasksExtensions is null)
99+
{
100+
_SystemThreadingTasksExtensions = AssemblyMetadata.CreateFromImage(Resources.SystemThreadingTasksExtensions).GetReference(filePath: "System.Threading.Tasks.Extensions.dll", display: "System.Threading.Tasks.Extensions (netstandard20)");
101+
}
102+
return _SystemThreadingTasksExtensions;
103+
}
104+
}
105+
106+
private static ImmutableArray<PortableExecutableReference> _all;
107+
public static ImmutableArray<PortableExecutableReference> All
108+
{
109+
get
110+
{
111+
if (_all.IsDefault)
112+
{
113+
_all =
114+
[
115+
MicrosoftCSharp,
116+
MicrosoftVisualBasic,
117+
SystemThreadingTasksExtensions,
118+
];
119+
}
120+
return _all;
121+
}
122+
}
123+
}
124+
}
125+
10126
public static partial class NetStandard20
11127
{
12128
public static class Resources
@@ -689,6 +805,24 @@ public static class Resources
689805
public static byte[] SystemXmlXPathXDocument => ResourceLoader.GetOrCreateResource(ref _SystemXmlXPathXDocument, "netstandard20.System.Xml.XPath.XDocument");
690806
private static byte[]? _SystemXmlXPathXDocument;
691807

808+
/// <summary>
809+
/// The image bytes for Microsoft.CSharp.dll
810+
/// </summary>
811+
public static byte[] MicrosoftCSharp => ResourceLoader.GetOrCreateResource(ref _MicrosoftCSharp, "netstandard20.Microsoft.CSharp");
812+
private static byte[]? _MicrosoftCSharp;
813+
814+
/// <summary>
815+
/// The image bytes for Microsoft.VisualBasic.dll
816+
/// </summary>
817+
public static byte[] MicrosoftVisualBasic => ResourceLoader.GetOrCreateResource(ref _MicrosoftVisualBasic, "netstandard20.Microsoft.VisualBasic");
818+
private static byte[]? _MicrosoftVisualBasic;
819+
820+
/// <summary>
821+
/// The image bytes for System.Threading.Tasks.Extensions.dll
822+
/// </summary>
823+
public static byte[] SystemThreadingTasksExtensions => ResourceLoader.GetOrCreateResource(ref _SystemThreadingTasksExtensions, "netstandard20.System.Threading.Tasks.Extensions");
824+
private static byte[]? _SystemThreadingTasksExtensions;
825+
692826

693827
}
694828
}

Src/Basic.Reference.Assemblies.NetStandard20/Generated.targets

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,5 +452,17 @@
452452
<LogicalName>netstandard20.System.Xml.XPath.XDocument</LogicalName>
453453
<Link>Resources\netstandard20\System.Xml.XPath.XDocument.dll</Link>
454454
</EmbeddedResource>
455+
<EmbeddedResource Include="$(NuGetPackageRoot)\microsoft.csharp\4.7.0\lib\netstandard2.0\Microsoft.CSharp.dll" WithCulture="false">
456+
<LogicalName>netstandard20.Microsoft.CSharp</LogicalName>
457+
<Link>Resources\netstandard20\Microsoft.CSharp.dll</Link>
458+
</EmbeddedResource>
459+
<EmbeddedResource Include="$(NuGetPackageRoot)\microsoft.visualbasic\10.3.0\lib\netstandard2.0\Microsoft.VisualBasic.dll" WithCulture="false">
460+
<LogicalName>netstandard20.Microsoft.VisualBasic</LogicalName>
461+
<Link>Resources\netstandard20\Microsoft.VisualBasic.dll</Link>
462+
</EmbeddedResource>
463+
<EmbeddedResource Include="$(NuGetPackageRoot)\system.threading.tasks.extensions\4.5.4\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll" WithCulture="false">
464+
<LogicalName>netstandard20.System.Threading.Tasks.Extensions</LogicalName>
465+
<Link>Resources\netstandard20\System.Threading.Tasks.Extensions.dll</Link>
466+
</EmbeddedResource>
455467
</ItemGroup>
456468
</Project>

Src/Basic.Reference.Assemblies.UnitTests/SanityUnitTests.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,64 @@ public void ReferencesLazyInit()
116116
Assert.NotEmpty(Net461.References.All);
117117
Assert.NotEmpty(Net472.References.All);
118118
}
119+
120+
[Fact]
121+
public void ExtraNetStandard20()
122+
{
123+
var source = """
124+
using System;
125+
126+
public class C
127+
{
128+
public System.Threading.Tasks.ValueTask Field1;
129+
public dynamic Field2;
130+
public Microsoft.VisualBasic.CompilerServices.NewLateBinding Field3;
131+
132+
static void Main()
133+
{
134+
Console.WriteLine("");
135+
}
136+
}
137+
""";
138+
139+
var compilation = CSharpCompilation.Create(
140+
"Example",
141+
[CSharpSyntaxTree.ParseText(source)],
142+
[.. NetStandard20.References.All, .. NetStandard20.ExtraReferences.All]);
143+
144+
Assert.Empty(compilation.GetDiagnostics());
145+
using var stream = new MemoryStream();
146+
var emitResult = compilation.Emit(stream);
147+
Assert.True(emitResult.Success);
148+
Assert.Empty(emitResult.Diagnostics);
149+
}
150+
151+
[Fact]
152+
public void ExtraNetStandardNet461()
153+
{
154+
var source = """
155+
using System;
156+
157+
public class C
158+
{
159+
public System.Threading.Tasks.ValueTask Field1;
160+
161+
static void Main()
162+
{
163+
Console.WriteLine("");
164+
}
165+
}
166+
""";
167+
168+
var compilation = CSharpCompilation.Create(
169+
"Example",
170+
[CSharpSyntaxTree.ParseText(source)],
171+
[.. Net461.References.All, .. Net461.ExtraReferences.All]);
172+
173+
Assert.Empty(compilation.GetDiagnostics());
174+
using var stream = new MemoryStream();
175+
var emitResult = compilation.Emit(stream);
176+
Assert.True(emitResult.Success);
177+
Assert.Empty(emitResult.Diagnostics);
178+
}
119179
}

0 commit comments

Comments
 (0)