In VS 2022, I found the selection in the Properties of DLL which was unable to be debugged.
Properties, Build, General, "Debug symbols"
In my case, initially "No symbols are emitted" was selected.
Changing that option to "PDB file, current platform" solved my particular problem. I am not sure why it was set to "No symbols are emitted".
The value is stored for .NET Framework in the .csproj file, under the DebugType entry, and there can be an entry for Debug, and for Release builds.