CON IT. Just CON IT!
I may have put a post up about this for V1 of the Mtg Discovery website, but it's bit me in the ass differently, so there's another post. Assuming I wrote one originally.
CON
has special meaning to Windows.
See https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#handle-legacy-devices for some details. The gist is
They designate a legacy device (CON, LPT1).
What this means is files named 'con.anything' are not really supported. And by not supported, I mean NOT POSSIBLE. (maybe, but not really)
As I'm working on data ingestion for v2 of Mtg Discovery, I got some FUNKY output on the console. Somewhere something was causing the a whole set json to be written to the screen somehow.
I put breakpoints on every Console.WriteLine I had. I use a wrapper so there's only 1. It's a nice way to do a console app.
So... WTF...
As you can see in the above screen shot, it's writing out a lot of json. And I didn't tell it too.
I'm processing a bunch of URLs in parallel. I had to serialize them to figure out which item was breaking me.
When I put it into series it jumped out at me. CON.json
. The parallel version is not obvious. It's a dozen+ lines above where the problem starts.
When it's right above the bad code, it's obvious.
I'd just added a http request file cache, so I knew immediately what the issue had to be... Windows does not play nice with CON. What I was baffled by is WHY IS IT IN THE CONSOLE WINDOW!?!?!
With suspicions of my file writing being the culprit, I wrote the following code in a new C# Console App.
File.WriteAllText("con.txt", "File Contents");
And it wrote to the console instead of to a file
Crazy stuff.
Fun and crazy. And a PIA.