09-26-2017 05:50 PM - edited 09-26-2017 05:52 PM
Hi all, apologies if this is simple. I couldn't find an answer by searching.
I have a C#.NET method that computes the MD5 hash of a local file, and returns the value as a string. I'm calling this from test stand, and storing the result in a local string variable (specifically named Locals.LocalHash).
I've attached my Visual Studio 2017 debugging session to my SeqEdit.exe process to facilitate debugging. The value returned from my method as seen in the Visual Studio watch window is:
fb9693902c5a10c2b21ae222fded26dc
The value saved into my Locals.LocalHash variable as seen in my TestStand watch window, however, is:
fb??96??93??90??2c??5a??10??c2??b2??1a??e2??22??fd??ed??26??dc
This obviously causes a mismatch when I check them.
Any ideas on why I might be seeing this? Thank you sincerely for the help.
Solved! Go to Solution.
09-28-2017 11:44 AM
I figured it out. For anyone who encounters this in the future, it was an issue with my string object. I suppose the way the C# library handles the string and Test Stand handles the string are different. I was originally filtering out unwanted characters (specifically lots of dashes) from my string using a regex replace like so:
Regex.Replace(file_hash_string, "[^A-Za-z0-9 ]", "")
but I think this somehow left trash characters, or null gaps in the string that .NET ignored but Test Stand had an issue with. Changing my replace character from "" to string.empty fixed the problem:
Regex.Replace(file_hash_string, "[^A-Za-z0-9 ]", String.Empty)
There are apparently differences between the two that can cause issue.