The traditional approaches for improving corrosion resistance of alloys typically lead to the sacrifice of mechanical properties because the microstructures needed for improving corrosion resistance often contradict those for high strength. Here we demonstrate that selected laser melting (SLM), a net-shape additive manufacture technique, can maintain good mechanical properties while double the corrosion-resistance of a N-doped CoCrFeNi HEA. The SLM processed sample possesses a heterogeneous microstructure with 3D dislocation cells inside each grain. The SLM-induced 3D dislocation cell structure can provide effective diffusion paths to significantly promote Cr outward segregation, forming a thick protective Cr oxide layer, which renders excellent corrosion resistance. Furthermore, Cr segregation along cell boundaries provides numerous sites for nucleation of oxides, and stabilizes the cell structure for good mechanical properties. The strategy discovered here may also be applied to other HEAs with multiple strengthening mechanisms.