If you’re working with Azure Service Fabric, there are chances you might be using the cluster Health Management APIs provided by SF SDK. And if you’re using those, then you would obviously be posting some custom health events at either your service level, application level or instance level with a source Id, health property and a human-readable description.
Solution : The one thing to note here is that the Description field of HealthInformation class has a limit of 4095 characters. This is nowhere mentioned in the documentation but it’s there. And if the description is more than that, while reporting you would get the below exception.
Exception Type : System.Argument Exception Message : Value does not fall within the expected range. Inner Exception : null Stack Trace : at System.Fabric.Interop.NativeClient.IFabricHealthClient3.ReportHealth(IntPtr healthReport) at System.Fabric.FabricClient.HealthClient.ReportHealthHelper(HealthReport healthReport) at System.Fabric.Interop.Utility.<>c__DisplayClass13.<WrapNativeSyncInvoke>b__12() at System.Fabric.Interop.Utility.WrapNativeSyncInvoke[TResult](Func`1 func, String functionTag, String functionArgs) at System.Fabric.Interop.Utility.RunInMTA(Action action) at System.Fabric.FabricClient.HealthClient.ReportHealth(HealthReport healthReport) at ….. your file.
So, in case you run into this exception at the point of reporting, make sure you double-check the description length and in-general all the data that you’ve added to the health report object.
Hope this helps!