Example A is indeed generally considered incorrect, but despite your comments, A and B are not grammatically identical. Sentence A is an attempt to use what in Europe is usually called a temporal clause equivalent. In such cases, the temporal clause is reduced by omitting the subject and using a participle of the verb.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.