I’ve encountered this myself with the Garmin Edge 520 I’ve noticed 2 things:
1) It seems when speed is below 10km/h (common on steep grades) gradient reads 0%. It must connected since when descending down the same hill it reads the proper grade.
2) Gradient data seems to be there on Strava.