So I created a DLL file, everything works fine the DLL file imports in unity without any error. But when I try to create a unity package containing that DLL and import it back again using the package I get this error :
The only solution is to download another version of the editor. The version in which I met the error is 2022.1.0 beta. I should have thought faster that it is something related to the version.