As far as I can tell, Virus has to be applied something like .75 to 1 second before the cast bar finishes or the game will have snap shotted the non-Virused damage. Same thing about damage mitigation buffs on the tank, you will occasionally see the buff active on the status bar before the attack is done casting and it will have no effect.

It definitely can be applied mid-cast though. The only snap shot that happens before the cast of an attack is which target is attacked (IE you can't Provoke a tank killer attack after cast to take the hit for whoever the boss aimed it at originally).