question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[IOS bug] string.Replace always returns null

See original GitHub issue

Description

string.Replace always returns null when run on IOS, while it returns correctly when running on Android.

Steps to Reproduce

    string test = "1 2 3 4 ";
    string t1 = test.Replace(" ", @",");

t1 should return “1,2,3,4,”, and it does on Android, however t1 is null on IOS.

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15

Did you find any workaround?

No response

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
hartezcommented, May 31, 2022

@danielftz Are you seeing this in the debugger, or is the actual result in code null? If you call System.Diagnostics.Debug.WriteLine(t1);, does it output null or 1,2,3,4, to the console?

We’ve been having some debugger issues in VS, I’m wondering if this is what you’re seeing.

1reaction
danielftzcommented, May 31, 2022

@danielftz Are you seeing this in the debugger, or is the actual result in code null? If you call System.Diagnostics.Debug.WriteLine(t1);, does it output null or 1,2,3,4, to the console?

We’ve been having some debugger issues in VS, I’m wondering if this is what you’re seeing.

You are correct, Debug.WriteLine() shows the correct output. I was checking the variable value by hovering over it when setting a breakpoint, and the bug shows up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Checking for null value (not nil or NSnull) in swift always ...
String ' the same error persist. I came to know that there is no equivalent of "null" in swift. Is there any hack...
Read more >
String.Format Method (System)
Converts the value of objects to strings based on the formats specified and inserts them into another string. If you are new to...
Read more >
str_replace - Manual
This function returns a string or an array with all occurrences of search in subject replaced with the given replace value. To replace...
Read more >
String functions | BigQuery
Returns an empty string if the code point is 0 . If an invalid Unicode code point is specified, an error is returned....
Read more >
JSON.stringify() - JavaScript - MDN Web Docs
The JSON.stringify() static method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found