Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4a0f2bf

Browse files
authored
Merge pull request#781 from dotnet-script/roslyn5
Roslyn5
2 parents1d74a87 +bf04dcf commit4a0f2bf

File tree

10 files changed

+110
-39
lines changed

10 files changed

+110
-39
lines changed

‎src/Dotnet.Script.Core/Dotnet.Script.Core.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<ItemGroup>
2727
<PackageReferenceInclude="Gapotchenko.FX"Version="2024.1.3" />
2828
<PackageReferenceInclude="Gapotchenko.FX.Reflection.Loader"Version="2024.1.3" />
29-
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp.Scripting"Version="4.11.0" />
29+
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp.Scripting"Version="5.0.0-2.final" />
3030
<PackageReferenceInclude="ReadLine"Version="2.0.1" />
3131
<PackageReferenceInclude="StrongNamer"Version="0.2.5"PrivateAssets="all" />
3232
</ItemGroup>

‎src/Dotnet.Script.Core/ScriptConsole.cs‎

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
usingSystem;
22
usingSystem.IO;
3+
usingSystem.Runtime.CompilerServices;
34
usingMicrosoft.CodeAnalysis;
45
usingRL=System.ReadLine;
56

67
namespaceDotnet.Script.Core
78
{
89
publicclassScriptConsole
910
{
10-
publicstaticreadonlyScriptConsoleDefault=newScriptConsole(Console.Out,Console.In,Console.Error);
11+
// Lazy to avoid touching anything during type initialization
12+
privatestaticreadonlyLazy<ScriptConsole>s_default=
13+
newLazy<ScriptConsole>(()=>newScriptConsole(Console.Out,Console.In,Console.Error));
14+
15+
publicstaticScriptConsoleDefault=>s_default.Value;
1116

1217
publicvirtualTextWriterError{get;}
1318
publicvirtualTextWriterOut{get;}
@@ -69,19 +74,59 @@ public virtual void WriteDiagnostics(Diagnostic[] warningDiagnostics, Diagnostic
6974

7075
publicvirtualstringReadLine()
7176
{
72-
returnIn==null?RL.Read():In.ReadLine();
77+
if(In!=null)
78+
returnIn.ReadLine();
79+
80+
returnReadLineInteractive();
7381
}
7482

7583
publicScriptConsole(TextWriteroutput,TextReaderinput,TextWritererror)
7684
{
7785
if(input==null)
7886
{
79-
RL.HistoryEnabled=true;
87+
TryEnableReadLineHistory();
8088
}
8189

8290
Out=output;
8391
Error=error;
8492
In=input;
8593
}
94+
95+
// Isolate the ReadLine reference so JIT does not resolve it unless called.
96+
[MethodImpl(MethodImplOptions.NoInlining)]
97+
privatestaticstringReadLineInteractive()
98+
{
99+
try
100+
{
101+
returnRL.Read();
102+
}
103+
catch(System.IO.FileLoadException)
104+
{
105+
// ReadLine is not strongly named or not resolvable on netfx test hosts; fallback to Console.ReadLine.
106+
returnConsole.ReadLine();
107+
}
108+
catch(TypeInitializationExceptiontie)when(tie.InnerExceptionisSystem.IO.FileLoadException)
109+
{
110+
returnConsole.ReadLine();
111+
}
112+
}
113+
114+
// Isolate the ReadLine reference so JIT does not resolve it unless called.
115+
[MethodImpl(MethodImplOptions.NoInlining)]
116+
privatestaticvoidTryEnableReadLineHistory()
117+
{
118+
try
119+
{
120+
RL.HistoryEnabled=true;
121+
}
122+
catch(System.IO.FileLoadException)
123+
{
124+
// netfx may require a strong-named dependency chain; ignore for tests.
125+
}
126+
catch(TypeInitializationExceptiontie)when(tie.InnerExceptionisSystem.IO.FileLoadException)
127+
{
128+
// Same case wrapped by a type initializer; ignore.
129+
}
130+
}
86131
}
87132
}

‎src/Dotnet.Script.Core/ScriptPublisher.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Dotnet.Script.Core
1111
{
1212
publicclassScriptPublisher
1313
{
14-
privateconststringScriptingVersion="4.11.0";
14+
privateconststringScriptingVersion="5.0.0-2.final";
1515

1616
privatereadonlyScriptProjectProvider_scriptProjectProvider;
1717
privatereadonlyScriptEmitter_scriptEmitter;

‎src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
<CompileInclude="..\Dotnet.Script.DependencyModel\ProjectSystem\ScriptParserInternal.cs"Link="ScriptParserInternal.cs" />
2121
</ItemGroup>
2222
<ItemGroup>
23-
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp.Scripting"Version="4.11.0" />
23+
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp.Scripting"Version="5.0.0-2.final" />
2424
</ItemGroup>
2525
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<runtime>
4+
<assemblyBindingxmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentityname="System.Collections.Immutable"publicKeyToken="b03f5f7f11d50a3a"culture="neutral" />
7+
<bindingRedirectoldVersion="0.0.0.0-9999.0.0.0"newVersion="9.0.0.0" />
8+
<codeBaseversion="9.0.0.0"href="System.Collections.Immutable.dll" />
9+
</dependentAssembly>
10+
<dependentAssembly>
11+
<assemblyIdentityname="System.Runtime.CompilerServices.Unsafe"publicKeyToken="b03f5f7f11d50a3a"culture="neutral" />
12+
<bindingRedirectoldVersion="0.0.0.0-9999.0.0.0"newVersion="6.0.1.0" />
13+
<codeBaseversion="6.0.1.0"href="System.Runtime.CompilerServices.Unsafe.dll" />
14+
</dependentAssembly>
15+
</assemblyBinding>
16+
</runtime>
17+
</configuration>
Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<ProjectSdk="Microsoft.NET.Sdk">
3-
<PropertyGroup>
4-
<TargetFramework>net472</TargetFramework>
5-
<SignAssembly>true</SignAssembly>
6-
<AssemblyOriginatorKeyFile>../dotnet-script.snk</AssemblyOriginatorKeyFile>
7-
</PropertyGroup>
8-
<ItemGroup>
9-
<PackageReferenceInclude="Microsoft.NET.Test.Sdk"Version="17.11.1" />
10-
<PackageReferenceInclude="xunit"Version="2.9.2" />
11-
<PackageReferenceInclude="xunit.runner.visualstudio"Version="2.8.2">
12-
<PrivateAssets>all</PrivateAssets>
13-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
14-
</PackageReference>
15-
<PackageReferenceInclude="Microsoft.Extensions.CommandLineUtils"Version="1.1.1" />
16-
<PackageReferenceInclude="Microsoft.NETFramework.ReferenceAssemblies"Version="1.0.3"PrivateAssets="All" />
17-
<PackageReferenceInclude="StrongNamer"Version="0.2.5"PrivateAssets="all" />
18-
</ItemGroup>
19-
<ItemGroup>
20-
<ProjectReferenceInclude="..\Dotnet.Script.Core\Dotnet.Script.Core.csproj" />
21-
<ProjectReferenceInclude="..\Dotnet.Script.DependencyModel\Dotnet.Script.DependencyModel.csproj" />
22-
<ProjectReferenceInclude="..\Dotnet.Script.Shared.Tests\Dotnet.Script.Shared.Tests.csproj" />
23-
</ItemGroup>
24-
<ItemGroup>
25-
<ContentInclude="xunit.runner.json">
26-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
27-
</Content>
28-
</ItemGroup>
1+
<ProjectSdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net472</TargetFramework>
4+
<SignAssembly>true</SignAssembly>
5+
<AssemblyOriginatorKeyFile>../dotnet-script.snk</AssemblyOriginatorKeyFile>
6+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
7+
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
8+
<ImmutablePkgVersion>9.0.0</ImmutablePkgVersion>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReferenceInclude="Microsoft.NET.Test.Sdk"Version="17.11.1" />
13+
<PackageReferenceInclude="xunit"Version="2.9.2" />
14+
<PackageReferenceInclude="xunit.runner.visualstudio"Version="2.8.2">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
17+
</PackageReference>
18+
<PackageReferenceInclude="Microsoft.Extensions.CommandLineUtils"Version="1.1.1" />
19+
<PackageReferenceInclude="Microsoft.NETFramework.ReferenceAssemblies"Version="1.0.3"PrivateAssets="All" />
20+
<PackageReferenceInclude="System.Collections.Immutable"Version="$(ImmutablePkgVersion)" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<ProjectReferenceInclude="..\Dotnet.Script.Core\Dotnet.Script.Core.csproj" />
25+
<ProjectReferenceInclude="..\Dotnet.Script.DependencyModel\Dotnet.Script.DependencyModel.csproj" />
26+
<ProjectReferenceInclude="..\Dotnet.Script.Shared.Tests\Dotnet.Script.Shared.Tests.csproj" />
27+
</ItemGroup>
28+
29+
<!-- overwrite output for Immutable to ensure netstandard2.0 asset!-->
30+
<TargetName="ForceNetStandardAssets"AfterTargets="Build">
31+
<CopySourceFiles="$(NuGetPackageRoot)system.collections.immutable\$(ImmutablePkgVersion)\lib\netstandard2.0\System.Collections.Immutable.dll"
32+
DestinationFolder="$(OutDir)"OverWriteReadOnlyFiles="true" />
33+
</Target>
2934
</Project>

‎src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1212
</PropertyGroup>
1313
<ItemGroup>
14-
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp.Scripting"Version="4.11.0" />
15-
<PackageReferenceInclude="System.Collections.Immutable"Version="8.0.0" />
14+
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp.Scripting"Version="5.0.0-2.final" />
15+
<PackageReferenceInclude="System.Collections.Immutable"Version="9.0.0" />
1616
</ItemGroup>
1717
</Project>

‎src/Dotnet.Script.Tests/ScriptExecutionTests.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void ShouldWriteCompilerWarningsToStandardError()
9191
{
9292
varresult=ScriptTestRunner.Default.ExecuteFixture(fixture:"CompilationWarning","--no-cache");
9393
Assert.True(string.IsNullOrWhiteSpace(result.StandardOut));
94-
Assert.Contains("CS1998",result.StandardError,StringComparison.OrdinalIgnoreCase);
94+
Assert.Contains("CS0162",result.StandardError,StringComparison.OrdinalIgnoreCase);
9595
}
9696

9797
[Fact]
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
publicasyncTaskFoo()
1+
usingSystem;
2+
3+
publicvoidFoo()
24
{
5+
return;
6+
Console.WriteLine("This is unreachable code.");
37
}

‎src/Dotnet.Script/Dotnet.Script.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<AssemblyOriginatorKeyFile>../dotnet-script.snk</AssemblyOriginatorKeyFile>
2626
</PropertyGroup>
2727
<ItemGroup>
28-
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp"Version="4.11.0" />
28+
<PackageReferenceInclude="Microsoft.CodeAnalysis.CSharp"Version="5.0.0-2.final" />
2929
<PackageReferenceInclude="McMaster.Extensions.CommandLineUtils"Version="4.1.1" />
3030
<PackageReferenceInclude="Microsoft.Extensions.Logging.Console"Version="10.0.0"Condition="'$(TargetFramework)' == 'net10.0'" />
3131
<PackageReferenceInclude="Microsoft.Extensions.Logging.Console"Version="9.0.0"Condition="'$(TargetFramework)' == 'net9.0'" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp