I've never seen this before

Hey Friends!

Got a weird one. I’m simply querying the Db and adding our customers to a list to iterate through, yet when I try to display an info message in the loop I get the following error:

I’ve done this many times before and have never seen this error. Here is the code…super simple.

var customers = Db.Customer.Where(w => w.Inactive == false && w.Company == "test").Select(s => new {s.CustID, s.Name, s.Address1, s.Address2, s.Address3, s.City, s.State, s.Zip, s.Country, s.TermsCode}).ToList();
 foreach (var item in customers)
  {
    this.PublishInfoMessage(item.Name,
    Ice.Common.BusinessObjectMessageType.Information,
    Ice.Bpm.InfoMessageDisplayMode.Individual, "YourBO", "YourMethod");
}

:man_facepalming: does anyone have any clues?

I commented out the rest of the code where I was trying to display my JSON and restsharp response code. It seems like that info could be cached?

In a function? You know in 2024.2 you can write an actual log file? Might work better and not have to click on popups.

Hey thanks,

Yes this is a function. Coming from on-prem I would always write to the log using Ice.Diagnostics.Log.WriteEntry(). What is the best way to write to a log on cloud and view it?

I’m so glad you asked! One of the best things they added in 2024.2, I use it in every function now! The code samples are in here. You need to add two references and usings to get it to work.

image

And then after you write to the log you can pull it down via server file download. Its under User > Logs

6 Likes

Oh I’m definitly using this from now on. Thanks!

And it appears my previous data was cached, I think I read somewhere that infomessage data is stored in callcontext :thinking:

Closing and reopening the client resolved the issue.

2 Likes

Sad Jim Carrey GIF

3 Likes

Yeah but if you leave it open, after you find the log once, you can just keep hitting download. Its still a billion times better than not being able to write a log file.

As a frequent logger, I found I had to cut back in 2024.x as the log write was moved to the end of processing and I was overwriting the log buffer. The entries were in the server event viewer, but serverlog would be empty for that run.

So if you still want to use WriteEntry it is possible, you just have to judicious about what you are also logging.