«Can't create directory generated/code/Magento/Framework/App/ResourceConnection/.» in Windows

Fatal error: Uncaught RuntimeException: Can’t create directory generated/code/Magento/Framework/App/ResourceConnection/. in [Magento\Framework\App\ResourceConnection\Proxy] in lib\internal\Magento\Framework\Code\Generator.php:115 Stack trace:
0 lib\internal\Magento\Framework\Code\Generator\Autoloader.php(35): Magento\Framework\Code\Generator->generateClass(‘Magento\Framewo…’)

  1. lib\internal\Magento\Framework\Code\Reader\ClassReader.php(19): ReflectionClass->__construct(‘Magento\Framewo…’)
  2. lib\internal\Magento\Framework\ObjectManager\Definition\Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor(‘Magento\Framewo…’)
  3. lib\internal\Magento\Framework\ObjectManager\Factory\Dynamic\Develope in lib\internal\Magento\Framework\Code\Generator.php on line 115

I have solved the problem by deletion the generated folder (I restored it from the Magento distributive).

It looks like the same issue: Magento 2.3 bug on Windows: «Command line user does not have read and write permissions on generated directory»

The same problem: Magento 2.3 bug: «Class Magento\Store\Api\Data\WebsiteExtensionInterface does not exist» on «setup:static-content:deploy»

Hi ,
I have solved the problem by running the command setup:di:compile .

According to Magento, this serves the following purpose:

  • Application code generation (factories, proxies, and so on)
  • Area configuration aggregation (that is, optimized dependency injection configurations per area)
  • Interceptor generation (that is, optimized code generation of interceptors)
  • Interception cache generation
  • Repositories code generation (that is, generated code for APIs)
  • Service data attributes generation (that is, generated extension classes for data objects)