# Possible bug in vtkStringArray

**URL:** https://discourse.vtk.org/t/possible-bug-in-vtkstringarray/9528
**Category:** Support
**Created:** [October 5, 2022, 12:49am UTC](https://discourse.vtk.org/t/possible-bug-in-vtkstringarray/9528 "2022-10-05T00:49:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![MarKara](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@MarKara](https://discourse.vtk.org/u/MarKara)
#### Post date: [October 5, 2022, 12:49am UTC](https://discourse.vtk.org/t/possible-bug-in-vtkstringarray/9528/1 "2022-10-05T00:49:55Z")

</div>

Hi  
I recently moved from Activiz 6.3 to 9.3 and discovered possible bug in compiled vtkStringArray.  
Here is the test  
vtkStringArray stringArray = new vtkStringArray();  
stringArray.SetNumberOfValues(3);  
stringArray.SetValue(0, “alpha”);  
stringArray.SetValue(1, “beta”);  
stringArray.SetValue(2, “gamma”);

result

stringArray.GetValue(0) “”  
stringArray.GetValue(1) “\u0001”  
stringArray.GetValue(2) "\u0002

Please advise

MK

---

<div class="post-metadata">

### Author: ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)
#### Post date: [October 5, 2022, 4:08pm UTC](https://discourse.vtk.org/t/possible-bug-in-vtkstringarray/9528/2 "2022-10-05T16:08:52Z")

</div>

@LucasGandel this one may be for you

---

<div class="post-metadata">

### Author: ![MarKara](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@MarKara](https://discourse.vtk.org/u/MarKara)
#### Post date: [October 5, 2022, 7:47pm UTC](https://discourse.vtk.org/t/possible-bug-in-vtkstringarray/9528/3 "2022-10-05T19:47:29Z")

</div>

Yes, Lucas already responded directly to me and proposed temporary solution.  
Thanks

---

<div class="post-metadata">

### Author: ![LucasGandel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasgandel/32/1831_2.png) [@LucasGandel](https://discourse.vtk.org/u/LucasGandel)
#### Post date: [October 6, 2022, 6:02am UTC](https://discourse.vtk.org/t/possible-bug-in-vtkstringarray/9528/4 "2022-10-06T06:02:34Z")

</div>

I confirm the latest Activiz versions have issues with methods returning a string from the unmanaged code. This has been addressed recently and will be fixed in the next Activiz release.

In the meantime, you can work around the issue using vtkVariant:  
stringArray.GetVariantValue(0).ToStringWrapper(0, 6); // 0=DEFAULT\_FORMATING, 6=precision
