Skip to content

Commit

Permalink
Fix unexpected Remoting V1 deprecation errors (#397)
Browse files Browse the repository at this point in the history
- Restore original behavior of the `ActorRemotingProviderAttribute` and
`ServiceRemotingProviderAttribute` on NetStandard so that explicitly
specifying a redundant assembly attribute is not required. The attribute
is now required only on NetFx.
- Create NetFx test projects with the minimum set of tests for now to
verify new NetFx behavior.
- Make build.yml use pre-installed .NET 9 and disable strong name
verification to enable testing of the delay-signed NetFx assemblies.
- Make remoting provider error messages more descriptive.
- Make FabActUtil report exception messages as build errors and stack
trace as build messages.
- Increment build number for integration in WindowsFabric repo.
  • Loading branch information
olegsych authored Feb 26, 2025
1 parent d8da8df commit f86f9cc
Show file tree
Hide file tree
Showing 12 changed files with 612 additions and 444 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ jobs:
TEST_RESULT_DIR: drop\testresults
steps:
- uses: actions/checkout@v1
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Disable strong name verification for testing
shell: powershell
run: .\SkipStrongName.ps1
- name: Build Everything
shell: powershell
run: dotnet build buildAll.proj
Expand Down
25 changes: 25 additions & 0 deletions code.sln
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ServiceFabric.Act
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ServiceFabric.Actors.StateMigration.Tests", "test\unittests\Microsoft.ServiceFabric.Actors.StateMigration.Tests\Microsoft.ServiceFabric.Actors.StateMigration.Tests.csproj", "{1BDC4681-FDBA-4E55-A247-5F779627A4D7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "netfx", "netfx", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.ServiceFabric.Actors.Tests_netfx", "test\netfx\Microsoft.ServiceFabric.Actors.Tests\Microsoft.ServiceFabric.Actors.Tests_netfx.csproj", "{A5D7C812-6B48-71FD-CACC-C65326E24AC0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.ServiceFabric.Services.Remoting.Tests_netfx", "test\netfx\Microsoft.ServiceFabric.Services.Remoting.Tests\Microsoft.ServiceFabric.Services.Remoting.Tests_netfx.csproj", "{9DA198B2-2C88-432F-87A4-1962225A154B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -186,6 +192,22 @@ Global
{1BDC4681-FDBA-4E55-A247-5F779627A4D7}.Release|Any CPU.Build.0 = Release|Any CPU
{1BDC4681-FDBA-4E55-A247-5F779627A4D7}.Release|x64.ActiveCfg = Release|x64
{1BDC4681-FDBA-4E55-A247-5F779627A4D7}.Release|x64.Build.0 = Release|x64
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Debug|x64.ActiveCfg = Debug|Any CPU
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Debug|x64.Build.0 = Debug|Any CPU
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Release|Any CPU.Build.0 = Release|Any CPU
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Release|x64.ActiveCfg = Release|Any CPU
{A5D7C812-6B48-71FD-CACC-C65326E24AC0}.Release|x64.Build.0 = Release|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Debug|x64.ActiveCfg = Debug|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Debug|x64.Build.0 = Debug|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Release|Any CPU.Build.0 = Release|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Release|x64.ActiveCfg = Release|Any CPU
{9DA198B2-2C88-432F-87A4-1962225A154B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -210,6 +232,9 @@ Global
{B5E3B9D7-E91E-4B76-959D-D418E973FCAF} = {861D6F40-D3CE-46CF-B8AD-0215B9F38BE1}
{E5B52C61-66BE-4D71-88D2-E50F78011C72} = {8B80B63B-5107-4845-9F19-647CFA7911A3}
{1BDC4681-FDBA-4E55-A247-5F779627A4D7} = {BB93122C-21C5-4BB8-B385-74FC423D6027}
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {DEC12940-3D38-4526-9157-27CB8BD23D3D}
{A5D7C812-6B48-71FD-CACC-C65326E24AC0} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{9DA198B2-2C88-432F-87A4-1962225A154B} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8CC7D7F7-CBD9-428B-A190-7A4D56C920FE}
Expand Down
2 changes: 1 addition & 1 deletion properties/service_fabric_common.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!-- TODO: Versions numbers are changed here manually for now, Integrate this with GitVersion. -->
<MajorVersion>8</MajorVersion>
<MinorVersion>0</MinorVersion>
<BuildVersion>11</BuildVersion>
<BuildVersion>12</BuildVersion>
<Revision>0</Revision>

</PropertyGroup>
Expand Down
14 changes: 9 additions & 5 deletions src/FabActUtil/Microsoft.ServiceFabric.Actors.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="FabActUtilGenerateManifestVS2013" AfterTargets="Build" Condition="'$(RunFabActUtil)' == 'true' and '$(VS2013ServiceFabricActorBuild)' == 'true'">
<Exec Command="&quot;$(MSBuildThisFileDirectory)FabActUtil.exe&quot; /out:&quot;$(PackageRoot)&quot; /t:manifest /ap:$(ApplicationPrefix) /sp:$(ServicePackagePrefix) /in:&quot;$(OutDir)$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)&quot; (FabActUtilAdditionalArguments)" WorkingDirectory="$(MSBuildProjectDirectory)" />
<Exec Command="&quot;$(MSBuildThisFileDirectory)FabActUtil.exe&quot; /out:&quot;$(PackageRoot)&quot; /t:manifest /ap:$(ApplicationPrefix) /sp:$(ServicePackagePrefix) /in:&quot;$(OutDir)$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)&quot; (FabActUtilAdditionalArguments)"
WorkingDirectory="$(MSBuildProjectDirectory)" LogStandardErrorAsError="true" />
</Target>
<Target Name="FabActUtilGenerateScriptVS2013" AfterTargets="FabActUtilGenerateManifestVS2013" Condition="'$(RunFabActUtil)' == 'true' and '$(VS2013ServiceFabricActorBuild)' == 'true'">
<Exec Command="&quot;$(MSBuildThisFileDirectory)FabActUtil.exe&quot; /out:&quot;$(PackageRoot)\..&quot; /t:script /ap:$(ApplicationPrefix) /sp:$(ServicePackagePrefix) /in:&quot;$(OutDir)$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)\&quot; $(FabActUtilAdditionalArguments)" WorkingDirectory="$(MSBuildProjectDirectory)" />
<Exec Command="&quot;$(MSBuildThisFileDirectory)FabActUtil.exe&quot; /out:&quot;$(PackageRoot)\..&quot; /t:script /ap:$(ApplicationPrefix) /sp:$(ServicePackagePrefix) /in:&quot;$(OutDir)$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)\&quot; $(FabActUtilAdditionalArguments)"
WorkingDirectory="$(MSBuildProjectDirectory)" LogStandardErrorAsError="true" />
</Target>
<Target Name="FabActUtilCopyCodeVS2013" AfterTargets="FabActUtilGenerateScriptVS2013" Condition="'$(RunFabActUtil)' == 'true' and '$(VS2013ServiceFabricActorBuild)' == 'true'">
<RemoveDir Directories="$(ServicePackagePath)\Code" />
Expand All @@ -18,7 +20,8 @@ Copyright (C) Microsoft Corporation. All rights reserved.
</Target>

<Target Name="_UpdateServiceFabricServiceManifest" AfterTargets="Build" Condition=" '$(UpdateServiceFabricManifestEnabled)' == 'true' and '$(VS2013ServiceFabricActorBuild)' != 'true' ">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\FabActUtil.exe&quot; /spp:&quot;$(ServicePackagePath)&quot; /t:manifest /sp:&quot;$(ServicePackagePrefix)&quot; /in:&quot;$(OutDir)\$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)\&quot; $(FabActUtilAdditionalArguments)" WorkingDirectory="$(MSBuildProjectDirectory)" />
<Exec Command="&quot;$(MSBuildThisFileDirectory)\FabActUtil.exe&quot; /spp:&quot;$(ServicePackagePath)&quot; /t:manifest /sp:&quot;$(ServicePackagePrefix)&quot; /in:&quot;$(OutDir)\$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)\&quot; $(FabActUtilAdditionalArguments)"
WorkingDirectory="$(MSBuildProjectDirectory)" LogStandardErrorAsError="true" />
</Target>
<Target Name="_UpdateServiceFabricApplicationManifest" Condition=" '$(UpdateServiceFabricManifestEnabled)' == 'true' and '$(VS2013ServiceFabricActorBuild)' != 'true' ">
<PropertyGroup>
Expand All @@ -28,6 +31,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<Local1NodeStartupServiceParamFileArg Condition=" '$(Local1NodeStartupServiceParamFile)' != '' ">/local1nodestartupserviceparamfile:&quot;$(Local1NodeStartupServiceParamFile)&quot;</Local1NodeStartupServiceParamFileArg>
<StartupServicesFilePathArg Condition=" '$(StartupServicesFilePath)' != '' ">/ssfp:&quot;$(StartupServicesFilePath)&quot;</StartupServicesFilePathArg>
</PropertyGroup>
<Exec Command="&quot;$(MSBuildThisFileDirectory)\FabActUtil.exe&quot; /app:&quot;$(ApplicationPackagePath)&quot; /spp:&quot;$(ServicePackagePath)&quot; /t:manifest /ap:&quot;$(ApplicationPrefix)&quot; /sp:&quot;$(ServicePackagePrefix)&quot; /in:&quot;$(OutDir)\$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)\&quot; $(StartupServicesFilePathArg) $(Local5NodeAppParamFileArg) $(Local1NodeAppParamFileArg) $(Local5NodeStartupServiceParamFileArg) $(Local1NodeStartupServiceParamFileArg) $(FabActUtilAdditionalArguments)" WorkingDirectory="$(MSBuildProjectDirectory)" />
<Exec Command="&quot;$(MSBuildThisFileDirectory)\FabActUtil.exe&quot; /app:&quot;$(ApplicationPackagePath)&quot; /spp:&quot;$(ServicePackagePath)&quot; /t:manifest /ap:&quot;$(ApplicationPrefix)&quot; /sp:&quot;$(ServicePackagePrefix)&quot; /in:&quot;$(OutDir)\$(AssemblyName).$(OutputType)&quot; /arp:&quot;$(TargetDir)\&quot; $(StartupServicesFilePathArg) $(Local5NodeAppParamFileArg) $(Local1NodeAppParamFileArg) $(Local5NodeStartupServiceParamFileArg) $(Local1NodeStartupServiceParamFileArg) $(FabActUtilAdditionalArguments)"
WorkingDirectory="$(MSBuildProjectDirectory)" LogStandardErrorAsError="true" />
</Target>
</Project>
</Project>
145 changes: 73 additions & 72 deletions src/FabActUtil/Program.cs
Original file line number Diff line number Diff line change
@@ -1,72 +1,73 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------

namespace FabActUtil
{
using System;
using System.IO;
using System.Reflection;
using FabActUtil.CommandLineParser;

internal class Program
{
private static string assemblyResolvePath;

private static int Main(string[] args)
{
var parsedArguments = new ToolArguments();
if (!CommandLineUtility.ParseCommandLineArguments(args, parsedArguments) || !parsedArguments.IsValid())
{
Console.Write(CommandLineUtility.CommandLineArgumentsUsage(typeof(ToolArguments)));
return -1;
}

try
{
assemblyResolvePath = parsedArguments.AssemblyResolvePath;
var currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveHandler);

Tool.Run(parsedArguments);
}
catch (Exception e)
{
Console.Error.WriteLine(e);
return -1;
}

return 0;
}

private static Assembly ResolveHandler(object sender, ResolveEventArgs args)
{
// The ResolveHandler is called if the dependencies are not in same location as the executable.
if (assemblyResolvePath != null)
{
if (Directory.Exists(assemblyResolvePath))
{
// try to load dll and then exe
var assemblyName = new AssemblyName(args.Name).Name;
var assemblyPath = Path.Combine(assemblyResolvePath, assemblyName + ".dll");

if (File.Exists(assemblyPath))
{
return Assembly.LoadFrom(assemblyPath);
}
else
{
assemblyPath = Path.Combine(assemblyResolvePath, assemblyName + ".exe");
if (File.Exists(assemblyPath))
{
return Assembly.LoadFrom(assemblyPath);
}
}
}
}

return null;
}
}
}
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------

namespace FabActUtil
{
using System;
using System.IO;
using System.Reflection;
using FabActUtil.CommandLineParser;

internal class Program
{
private static string assemblyResolvePath;

private static int Main(string[] args)
{
var parsedArguments = new ToolArguments();
if (!CommandLineUtility.ParseCommandLineArguments(args, parsedArguments) || !parsedArguments.IsValid())
{
Console.Write(CommandLineUtility.CommandLineArgumentsUsage(typeof(ToolArguments)));
return -1;
}

try
{
assemblyResolvePath = parsedArguments.AssemblyResolvePath;
var currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveHandler);

Tool.Run(parsedArguments);
}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
Console.WriteLine(e);
return -1;
}

return 0;
}

private static Assembly ResolveHandler(object sender, ResolveEventArgs args)
{
// The ResolveHandler is called if the dependencies are not in same location as the executable.
if (assemblyResolvePath != null)
{
if (Directory.Exists(assemblyResolvePath))
{
// try to load dll and then exe
var assemblyName = new AssemblyName(args.Name).Name;
var assemblyPath = Path.Combine(assemblyResolvePath, assemblyName + ".dll");

if (File.Exists(assemblyPath))
{
return Assembly.LoadFrom(assemblyPath);
}
else
{
assemblyPath = Path.Combine(assemblyResolvePath, assemblyName + ".exe");
if (File.Exists(assemblyPath))
{
return Assembly.LoadFrom(assemblyPath);
}
}
}
}

return null;
}
}
}
Loading

0 comments on commit f86f9cc

Please sign in to comment.