So the only workaround to do is removing the property since it's not implemented in .NET. With that, I can generate the fakes assemblies.
More details here.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello, I'm using VS 2019 Enterprise version 16.11.4 and I'm trying to generate fake assemblies from my own classes of that project or any other assembly (even 3rd party) I have the following errors:
And opening the error, it goes to the generated code and I can see that there is a following generated code:
// Some previous code
[assembly: global::System.Runtime.CompilerServices.InternalsVisibleTo("Primavera.Core.Applications, PublicKey=0024000004800000940000000602000000240000525341310004000001000100bfbbcfcfa45d349492d7a837b93e972950a9754029e1973b2f8cf38fabffba0b2380c15581b3a76d1626e4606f4c88ef2f03a0cc245e9390cd884545cf4021b6a177b6a0acef89d296adf0e2c631300b60bca05d38dcfb7318dbbcac767fd905dfdfcc05aea91a5aef718c4f9b5f2cc427671c6a4520f104f51da60f0c68e6c7", AllInternalsVisible = 1)]
// Some next code
And as you can see it tries to generate an int where it should be a bool:
AllInternalsVisible = 1
instead of
AllInternalsVisible = true
I'm using Microsoft.QualityTools.Testing.Fakes version 16.11.230815.
The test project where I'm adding fakes is .NET 5.0 and the assemblies that I'm generating fakes are .NET Standard 2.1
Can you help me fix this issue?
So the only workaround to do is removing the property since it's not implemented in .NET. With that, I can generate the fakes assemblies.
More details here.
Hi @Kyrylo Yavorenko ,
Welcome to Microsoft Q&A!
Can you create a new project to verify if the error occurs in all projects or not?
Please try to delete the bin
, obj
and FakesAssemblies folders and recreate the Fakes assembly to check again.
(Please backup the file before any modification, in case we need to roll back.)
Meanwhile, you can also repair your Visual Studio in VS installer > More > Repair..
Sincerely,
Anna
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.