Validation for DropDownLists Broken

This is related to a previous question on passing model data to a partial view from two DropDownLists where the user must select department and year in a view. Numerical data is then displayed in a table in the partial view. The view contains the dropdowns and the table headers. The partial view contains the rows with the numerical data. Right now, the validation is broken. Both dropdowns are required. If I submit form with either dropdown not selected, I get this error:

Directory.GetCurrentDirectory() doesn’t point to bin folder anymore

I have an ASP.Net Core 3.1 solution that uses a Docker Compose file as its startup project. Calling the method Directory.GetCurrentDirectory() from anywhere in the code returns the string /app, which is weird as I was expecting this string to include /bin/Debug/netcoreapp3.1 or (Release if I build the code in release mode). If I go into the docker container that runs the code, the executing code is located at /app/bin/Debug/netcoreapp3.1.