The phrase "Why didn't you ask" is grammatically correct and can be used in written English. It is typically used when expressing surprise that someone did not ask a question. For example, "You didn't know where the meeting was? Why didn't you ask?".
"Why didn't you ask what was wrong?
Why didn't you ask those questions?
You're experienced -- why didn't you ask those questions?
Why didn't you ask me?" "You were finally sleeping".
Ludwig does not simply clarify my doubts with English writing, it enlightens my writing with new possibilities
Simone Ivan Conte
Software Engineer at Adobe, UK