79427428

Date: 2025-02-10 14:48:32
Score: 1.5
Natty:
Report link

I came across kinda similar issue when working with Reqnroll (formerly known as Specflow) ScenarioContext object:

System.InvalidCastException : Unable to cast object of type 'System.String' to type 'System.Func`1[System.String]'.
   at Reqnroll.ReqnrollContext.TryGetValue[TValue](String key, TValue& value)
   at Helpers.Extensions.ScenarioContextExtensions.GetTextValueOrKey[T](ScenarioContext scenarioContext, String key)

It does give you relevant information as well. During closer inspection I have realized that I am trying to do something that is already done out of the box:

https://github.com/reqnroll/Reqnroll/blob/main/Reqnroll/ReqnrollContext.cs#L33 https://github.com/reqnroll/Reqnroll/blob/main/Reqnroll/ReqnrollContext.cs#L76

I hope it might help somebody in the future :)

Reasons:
  • Blacklisted phrase (1): I am trying to
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Gucu112