UiPath.Core.Activities.AppLog encounters compiler error BC30560:"AppLog is ambiguous..." in "Invoke Code" activity

Hello everyone,
I am trying to log a message in a “Invoke Code” activity using this object(UiPath.Core.Activities.Applog) I found in the UiPath.Core.Activities namespace, but the compiler shows the error

BC30560:‘Applog’ is ambiguous in the namespace ‘UiPath.Core.Activities’.

I tried fully defining the name of the object, but it still showed this error. There was another topic about programmatically logging Errors or Warnings, but they seem to have not reached a solution to the problem either.
Has anyone got a clue as to why this compiler error might be occurring?

Thanks to everyone who is trying to help in advance,
Cheers
Dan

Hi @DannyVelkov,
Welcome to the Community!
Instead of doing it directly in the invoke code you may define an output argument with information that you need and use those arguments in the standard Log message activity.

Thanks for your reply Pablito.
I’m amazed of the quick response to this question.
Right now your solution is exactly how I have implemented it, but the logged messages’ timing is not accurate because they appear after all the Console.WriteLine() messages inside the Invoke Code activity itself. That means that if I have a FOR loop inside of the Invoke Code Activity, the error will be logged last, after all the try/catch blocks inside the loop.

Also- a note for everyone trying to help: don’t defer from the specified problem in your answers. I am explicitly asking for help on the compiler error.

Thank you

Hi @DannyVelkov,
Sorry for the late response. Have you tried to use the Console.WriteLine method instead of the object you’ve tried to use?