New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string.IndexOf("string") not working in Raspberry Pi project #33997
Comments
@tarekgh The overload |
did you mean It will be hard to tell what could be the problem, the only thing I can think of could be the codepage used for reading the file. could you please try after reading the whole text, print every single character: string sensorStatus = System.IO.File.ReadAllText(path);
foreach (char c in sensorStatus)
{
Console.WriteLine($"{c} ... {(int)c:x}");
} Also, could you please get the value of the environment variable |
Yes, |
OK, thank you and I'm very sorry for disturbing you all.. Everything works as intended except my SDCARD which was used in my Raspberry Pi. I have finally discovered this issue when my app started failing during web server initialization when tried to ask about System Culture etc. After I replaced that everything started to work again. Again sorry and thank you for your support! |
I have recently upgraded .NET Core 3.1 SDK to version v3.1.200 with Visual Studio Community 2019 and I'm building and application for Raspberry Pi where one part of it reads the content on specific file from filesystem and parses it (very simple).
Some days ago (don't remember previous core version) but it was working correctly. Now suddently stopped. The problem is with searching of a specific substring position in the file using string.IndexOf method. It always gets me return value of -1 for whatever string I search for, even with only char inside. But when I search for last char of '=' it gives me proper index result. (But I want to search for "t=" substring here anyway)..
File content:
w1_slave.txt
The same file content (whole file) copied and run in Windows yield with proper parsed value.
Am I missing something here? What is even funnier the same code before worked but can't recall exact framework versions etc..
The text was updated successfully, but these errors were encountered: