I've got a bit of a mind boggler. I have a particular little line of code, that converts a base64 string back to a byte[]. On my development pc it works without issues, but when deployed to our app server, the resulting byte array is always empty, and I can't figure out why.
I'm hoping some of you geniuses out there might know the answer?
Here's the simple one line of code:
byte[] fileBytes = Convert.FromBase64String("SGVsbG8gV29ybGQhIQ==");
Some context, the app that this is from is an asp.net core 2.1 web API project. The app server OS is Windows Server 2008 R2. I have the .net core 2.1.4 runtime/hosting bundle installed. The base64 string sample was created in a JavaScript application and is a plain text file that contains "Hello World!!"
Any help is greatly appreciated.
Ok, so it turns out I was being a real idiot, lol. I was writing the byte[] in a log, which gave me System.byte[]. For some reason I convinced myself this meant the array was empty. To support my delusion, I was getting an error on a line that creates a memory stream from the byte[]. This morning while bashing my head on it, I realized the error I'm getting is a NullReferenceException, which does not make sense for an empty array.
Long story short, the error was not what I though it was, my apologies for wasting anyone's time.
At least I have a new lead to go on to solve my error now. Thanks for everyone that tried/wanted to help!