I upgraded my Service Fabric application project from .Net Core 2.2 and updated all my packages. After that the service won't run (see the exception below).
We have an old version of SF running and are hosting SF on-premise.
Before updating:
<PackageReference Include="Microsoft.ServiceFabric.Services" Version="3.2.162" />
<PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="3.2.162" />
and I was attempting to update to
<PackageReference Include="Microsoft.ServiceFabric.Services" Version="4.0.457" />
<PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="4.0.457" />
C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\NS_7\ does not exist on my computer, but I do have C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\NS.
I have SF 6.3.176.9494 and SDK of 3.2.176.9494 installed locally.
When I reset my changes, back to .Net Core 2.2, the stateful service works correctly.
I was unable to find information about the NS_7 directory. Does each version of the SDK/runtime create a different directory?
Is there a way to get it working without having to update the versions of SF running on all developers machines and then on all our test servers and prod servers? Our DevOps team is looking into Ansible or other tools to make this easier, but right now it's all manual.
Here's the exception I get.
Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus', HealthState='Warning', ConsiderWarningAsError=false.
Replica had multiple failures during open on _Node_0. API call: IStatefulServiceReplica.Open(); Error = System.IO.FileNotFoundException (-2147024893)
Could not load file or assembly 'C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\NS_7\Microsoft.ServiceFabric.Data.Impl.dll'. The system cannot find the path specified.
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Microsoft.ServiceFabric.Data.ReliableStateManager..ctor(StatefulServiceContext serviceContext, ReliableStateManagerConfiguration configuration)
at Microsoft.ServiceFabric.Services.Runtime.StatefulService..ctor(StatefulServiceContext serviceContext)
at QueueService..ctor(StatefulServiceContext serviceContext) in C:\git\Service\Provider\ServiceFabric\QueueService.cs:line 22
at Program.<>c.
b__0_0(StatefulServiceContext context) in C:\\git\Provider\ServiceFabric\Program.cs:line 22
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaFactory.System.Fabric.IStatefulServiceFactory.CreateReplica(String serviceTypeName, Uri serviceName, Byte[] initializationData, Guid partitionId, Int64 replicaId)
at System.Fabric.ServiceFactoryBroker.<>c__DisplayClass8_0.b__0(IStatefulServiceFactory factory, ServiceInitializationParameters initParams)
at System.Fabric.ServiceFactoryBroker.CreateHelper[TFactory,TReturnValue](IntPtr nativeServiceType, IntPtr nativeServiceName, UInt32 initializationDataLength, IntPtr nativeInitializationData, Guid partitionId, Func`3 creationFunc, Action`2 initializationFunc, ServiceInitializationParameters initializationParameters)
For more information see: http://aka.ms/sfhealth
I've updated my SF SDK and runtime to the latest and things work. I guess the best path will be to upgrade everything (I like that myself, but it's sometimes difficult to get everyone else to go along with it).
I wrote up what I went through after I had a lot of uninstall issues. Maybe that will help someone.
Most helpful comment
I've updated my SF SDK and runtime to the latest and things work. I guess the best path will be to upgrade everything (I like that myself, but it's sometimes difficult to get everyone else to go along with it).
I wrote up what I went through after I had a lot of uninstall issues. Maybe that will help someone.