Cannot use type 'StackExchange.Redis.RawResult'. Only value types without pointers or references are supported.

Hi, I am new to Creatio, now I am trying to debug the code I wrote in a business process as I see a problem in the logs I have written in the code, I attach the file to the service, restart Creatio application, then this error is thrown

 

I am using redis on docker version 6.2.13

and this is my code for the BP

private bool ScriptTask1Execute(ProcessExecutingContext context) {
    ILog logger = LogManager.GetLogger("TestLog");
    
    var list = Get>("ReadDataUserTask1.ResultCompositeObjectList");
    
    foreach (ICompositeObject item in list) {
        if (item.TryGetValue("Price", out string price)) 
        {
            logger.Info($"price acquired: {price}");
        }
        
        if (item.TryGetValue("City", out string city)){
           logger.Info($"city acquired: {city.ToString()}");
        }
        
        logger.Info($"Processing record - City: {city}, Price: {price}");
    
    }
    
    return true;
}
 

Like 0

Like

1 comments

Hello,

The error "Cannot use type 'StackExchange.Redis.RawResult'. Only value types without pointers or references are supported" occurs because the Get method is returning a type that is not directly compatible with the expected type in your code. Specifically, the Get method is likely returning a StackExchange.Redis.RawResult or a similar type, which cannot be directly used in the context of your script.
To fix this issue, you need to ensure that the Get method returns a type that can be processed in your script.
In order to fix this issue you should:
1. Check the Return Type of Get Method

  • Verify what type the Get method is returning. It seems that the Get method is returning a StackExchange.Redis.RawResult or another incompatible type.
  • If the Get method is returning raw data, you need to deserialize or convert it into a compatible type, such as a list of ICompositeObject.

2. Deserialize or convert the data

  • If the data returned by Get is in a serialized format (e.g., JSON), you need to deserialize it into a list of ICompositeObject.
  • Use a deserialization library like Newtonsoft.Json or System.Text.Json to convert the raw data into the desired type.
Show all comments