I upgraded magento version by documentation, after upgrade this happens:
When running php bin/magento cache:flush or any other bin/magento command error appears There are no commands defined in the " " namespace When running php bin/magento list these errors appear:
In ServiceManager.php line 1130:
An abstract factory could not create an instance of magentosetupconsolecommanddbstatuscommand(alias: Magento\Setup\Console\Command\DbStatusCommand).
In ServiceManager.php line 941:
An exception was raised while creating "Magento\Setup\Console\Command\DbStatusCommand"; no instance returned
In ClassReader.php line 19:
Class Magento\Framework\Setup\Declaration\Schema\FileSystem\XmlReader does not exist
There are no missing module.xml in any custom modules.
UPDATE:
few modules module.xml had this:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
instead it should be this:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
UPDATE2: same error still persists. Tried
rm -rf var/cache/* var/page_cache/* var/di/* var/generation/* var/view_preprocessed/*
and composer update above fix didn not help still.