I was battling a Aegislash when I used Gastro Acid on Aegislash but it failed. Why didn't Gastro Acid work on Aegislash?
Actually, Gastro Acid effects steel-type Pokemon despite that it is classified as a poison type.
It didn't work because Aegislash's ability, Stance Change, can't be replaced or suppressed.
Source: Bulbapedia - or you can try it yourself.