I had the same problem and I fixed it.
i will try to explain it as good as possible.
From twrp you will enter and first put on sd the rom, magisk.zip, magisk manager,and magisk uninstaller.
You enter twrp first install the magisk uninstaller after reboot to recovery. Then wipe dalvic cache...