The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
I am reminded of a cartoon in the MAD Magazine, where a painter has painted a bunch of concentric circles, and is angry at the exhibitor for having hung it upside down. Just a bunch of concentric circles, where direction does not count.
This works fine in a WinForm and Console application, but I kept getting a "content formatting error" from their server when I tried the exact same code in my WCF Service Application running under IIS. According to their devs, the JSON was coming in as an escaped string. But as I said, this only happens when testing the same code in my WCF Service.
Ironically, the solution was to add an object, not a string, to AddJsonBody:
var config = new Config();
... do some setup stuff ...
Now that works great on WinForm, Console, and the WCF Service App.
So the question still remains, what is IIS/WCF doing, or is it RestClient, that is creating an escaped JSON string? Or is it some bug on the third-party's server when it receives the call from another "server"?
I have no idea, I'm not asking a programming question or looking for an answer, I just wanted to share this with you all so if you encounter something goofy like this in the future, this might help.
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
I seem to remember running into a similar issue but it was a long time ago.
IIRC (and I may well not), the problem was that WCF was auto-serialising behind the scenes so I was serialising as per normal, then it re-serialised my already serialised string, causing a whole load of extra escapes.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
Could it B that you don't C that it's a L of A nice letter?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
Though not in need of a job change, I just sent some feelers in the online world. One Recruiter contacted me about an opportunity which was good but said It involves some coding demonstration , which was fine with me. So he wanted to know what I need to do a coding so he can arrange it in his office. I mentioned that would prefer Keyboard (English and not German), mouse and big monitor along with internet connection.
He asked the purpose of Internet, and said need to Google the syntax or whatever. He replied saying googling for syntax or any reference is not acceptable for Engineer/Developers. Also Mentioned that the Company wont accept it as a legit test.
I directly approach the company after figuring out and I got the coding package with requirements and instructions. Interesting part is that I am allowed to do from home and use any resources like books, internet, opensource code etc. Only thing they had mentioned is that If I am using Code/Module from external source , I should cite its source.
The footer in the instruction has this quote "The standard library saves programmers from having to reinvent the wheel" - Bjarne Stroustrup
Too much of good is bad,mix some evil in it