# Invoke code error csharp

**URL:** <https://forum.uipath.com/t/invoke-code-error-csharp/492325>\
**Category:** Studio\
**Tags:** tools, question, studio, system, activities\
**Created:** [November 21, 2022, 3:30pm UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325 "2022-11-21T15:30:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![robot\_robot](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/robot_robot/32/263167_2.png) [@robot\_robot](https://forum.uipath.com/u/robot_robot)\
**Post date:** [November 21, 2022, 3:30pm UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/1 "2022-11-21T15:30:34Z")

</div>

I am trying to make a process which uploads files to page and I am creating it in C#.

In one part of the process I have used Invoke Code but this is giving me error, Could you help me please?

 ![image](https://global.discourse-cdn.com/uipath/original/4X/5/b/0/5b0222f1cdd4cb09b702e8043bf199e99ac49350.jpeg)  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/2/d/1/2d1608853254c6c2c1e8c3ea863d9a17b6b93ccd.jpeg)  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/a/b/1ab5ec8f3b3cf44deddd4d0bbf71d8b03f057970.jpeg)

---

<div class="post-metadata">

**Author:** ![Konrad\_Mierzwa](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/konrad_mierzwa/32/464054_2.png) [@Konrad\_Mierzwa](https://forum.uipath.com/u/Konrad_Mierzwa)\
**Post date:** [November 21, 2022, 6:44pm UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/2 "2022-11-21T18:44:35Z")

</div>

Could you show as error message?

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [November 22, 2022, 12:22am UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/3 "2022-11-22T00:22:49Z")

</div>

Hi,

As C# is case-sensitive, you need to modify “Using” to “using” and “If” to “if” at least.

 ![image](https://global.discourse-cdn.com/uipath/original/4X/8/1/7/817b6d713dbddce49b0298518b6fa031631f5c88.jpeg)

Please check your error message to identify which part is wrong.

Regards,

---

<div class="post-metadata">

**Author:** ![robot\_robot](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/robot_robot/32/263167_2.png) [@robot\_robot](https://forum.uipath.com/u/robot_robot)\
**Post date:** [November 22, 2022, 12:28am UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/4 "2022-11-22T00:28:56Z")

</div>

@Konrad_Mierzwa @Yoichi I just modified it but still gives the error:

Error ERROR Validation Error No compiled code to run  
error CS1026: ) expected At line 3  
error CS1002: ; expected At line 3  
error CS1513: } expected At line 3  
error CS1002: ; expected At line 8  
error CS0305: Using the generic type ‘New’ requires 1 type arguments At line 3  
error CS1955: Non-invocable member ‘WebClient’ cannot be used like a method. At line 3  
error CS0103: The name ‘client’ does not exist in the current context At line 6  
error CS0305: Using the generic type ‘New’ requires 1 type arguments At line 8  
error CS1955: Non-invocable member ‘X509Certificate2Collection’ cannot be used like a method. At line 8 Main.xaml

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [November 22, 2022, 12:30am UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/5 "2022-11-22T00:30:45Z")

</div>

Hi,

For now, can you also modify “New” to “new”?  
And can you share your code as text file?

Regards,

---

<div class="post-metadata">

**Author:** ![robot\_robot](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/robot_robot/32/263167_2.png) [@robot\_robot](https://forum.uipath.com/u/robot_robot)\
**Post date:** [November 22, 2022, 12:34am UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/6 "2022-11-22T00:34:07Z")

</div>

thank you now there is no more error

---

<div class="post-metadata">

**Author:** ![robot\_robot](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/robot_robot/32/263167_2.png) [@robot\_robot](https://forum.uipath.com/u/robot_robot)\
**Post date:** [November 24, 2022, 12:43pm UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/7 "2022-11-24T12:43:37Z")

</div>

hello @Yoichi@Konrad_Mierzwa at the same project whrn I do debug, now it’s giving me this error. How to solve it please?

 ![image](https://global.discourse-cdn.com/uipath/original/4X/9/6/c/96c2c093da7e4605fa78fa7d427e3d11e4eb863f.jpeg)

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [November 24, 2022, 1:07pm UTC](https://forum.uipath.com/t/invoke-code-error-csharp/492325/8 "2022-11-24T13:07:22Z")

</div>

Hi,

It seems item variable is null. Can you check content of the item when error occurs?

If it’s null, can you try to add !string.IsNullOrEmpty as the following?

```
!string.IsNullOrEmpty(item) && ( item.Contains(".png") || item.Contains(".jpg") || ..........)

```

OR, if there is an expression behind the visible expression, please share it as text.

And as the above question is apart from title of this topic, perhaps you should create new topic because it will help those who face same issue.

Regards,
