# Invoke Code, LogMessage bug

**URL:** <https://forum.uipath.com/t/invoke-code-logmessage-bug/98692>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [February 28, 2019, 12:21pm UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692 "2019-02-28T12:21:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mkoval](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@Mkoval](https://forum.uipath.com/u/Mkoval)\
**Post date:** [February 28, 2019, 12:21pm UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692/1 "2019-02-28T12:21:30Z")

</div>

Hi,

We recently updated to 2018.4.3, and I noticed that for logging in invoke code activity, LogMessage.Message input argument changed from string to object.

```
Dim logMessage As UiPath.Core.Activities.LogMessage 
Dim logInvoker As WorkflowInvoker 

logMessage = New UiPath.Core.Activities.LogMessage()
 logMessage.Level = UiPath.Core.Activities.CurentLogLevel.Info
 logMessage.Message = "test message"
 logInvoker.invoke (logMessage) 
 logMessage = Nothing

```

` logMessage.Message = "test message"` does not accept string, and I’m having trouble converting this string into System.Activities.InArgument (Of Object) - it seems that this is the type it accepts. Therefore I’m unable currently to log from Invoke Code activity

Can anyone give me a suggestion how to do this?

Thank you

Edit: corrected type of input from Object to System.Activities.InArgument (Of Object)

---

<div class="post-metadata">

**Author:** ![HareeshMR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/hareeshmr/32/181825_2.png) [@HareeshMR](https://forum.uipath.com/u/HareeshMR)\
**Post date:** [February 28, 2019, 12:29pm UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692/2 "2019-02-28T12:29:18Z")

</div>

Hi @Mkoval,

You can use CType conversions to convert the data types to any other type.

To convert string to the object, here is the code :

```
         Dim rangeString As String
        Dim obj As Object = CType(rangeString, Object)

```

Hope it helps

---

<div class="post-metadata">

**Author:** ![Mkoval](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@Mkoval](https://forum.uipath.com/u/Mkoval)\
**Post date:** [February 28, 2019, 12:52pm UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692/3 "2019-02-28T12:52:05Z")

</div>

Nope, in your example you are converting string into string and trying to assign it to object.  
I made wrong assumption in the beginning. LogMessage.Message, accepts `System.Activities.InArgument (Of Object)` as input

So how to get there

---

<div class="post-metadata">

**Author:** ![andrzej.kniola](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/andrzej.kniola/32/8835_2.png) [@andrzej.kniola](https://forum.uipath.com/u/andrzej.kniola)\
**Post date:** [February 28, 2019, 7:55pm UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692/4 "2019-02-28T19:55:07Z")

</div>

You are going to give yourself a real headache if you try to do this in code instead of through Studio, as I assume you are doing right now based on your sample in the OP.

But if you want to - check below link, you might want to try passing a named dictionary alongside the activity:

> **[InArgument Class (System.Activities)](https://learn.microsoft.com/en-us/dotnet/api/system.activities.inargument-1?view=netframework-4.7.2)**
>
> A binding terminal that represents the flow of data into an activity.

There are other ways, but I gave up on this route some time ago.

Do note that no guarantees are given if you develop outside of Studio and reference UiPath packages (so above breaking change, while true, is NOT a bug, but an intended change since in Studio it is not a breaking change).

---

<div class="post-metadata">

**Author:** ![Ray\_Shen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ray_shen/32/52634_2.png) [@Ray\_Shen](https://forum.uipath.com/u/Ray_Shen)\
**Post date:** [March 22, 2019, 9:19am UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692/5 "2019-03-22T09:19:40Z")

</div>

Hello @Mkoval,  
I have met the same problem since updated to 2018.4.4, too  
Because there are so many logMessage codes in different InvokeCode activities I used, it’s hard to fix it one by one…  
Do you have any idea about this problem or have any suggestion ?

---

<div class="post-metadata">

**Author:** ![Mkoval](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@Mkoval](https://forum.uipath.com/u/Mkoval)\
**Post date:** [March 22, 2019, 9:44am UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692/6 "2019-03-22T09:44:54Z")

</div>

No, I spent maybe 3 days trying different approaches. In the end I pulled the logging out of VB, and broke VB into multiple separate parts. It was little bit of headache, as my code worked with COM objects. To sum it up, I had to completely rewrite the code, and we are deploying it this weekend together with production Orchestrator update

---

<div class="post-metadata">

**Author:** ![Ray\_Shen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ray_shen/32/52634_2.png) [@Ray\_Shen](https://forum.uipath.com/u/Ray_Shen)\
**Post date:** [March 24, 2019, 7:45am UTC](https://forum.uipath.com/t/invoke-code-logmessage-bug/98692/7 "2019-03-24T07:45:27Z")

</div>

I found that the description of logMessage.Message was System.Activities.InArgument (Of **String** ) in 2.6, but now it is System.Activities.InArgument (Of **Object** ), maybe it’s a bugfix (or a new bug 😂)?  
Anyway, thanks for your reply!
