Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSTEST0036 gives warning on static AssemblyInitialize Method #3950

Open
SeMuell opened this issue Oct 16, 2024 · 1 comment
Open

MSTEST0036 gives warning on static AssemblyInitialize Method #3950

SeMuell opened this issue Oct 16, 2024 · 1 comment

Comments

@SeMuell
Copy link

SeMuell commented Oct 16, 2024

Describe the bug

When using the newest version, a static method with the same name as in the base class (AssemblyInitialize) gives the warning warning MSTEST0036: Member 'AssemblyInitialize' already exists in the base class.

However, since the base class is coming from another assembly, the AssemblyInitialize must be repeated (and we are forwarding the call to the base class). Renaming the method of course worked.

Steps To Reproduce

  1. Create two test projects
  2. Create test class Class1 with static AssemblyInitialize and AssemblyInitialize attribute in project1.
  3. Create test class inheriting Class1 with AssemblyInitialize method and attribute.

Expected behavior

I personally would expect that the static methods with assembly initialize attribute would be ignored in the analyzer, or that the AssemblyInitialize would work when used from another project...

Actual behavior

Warning is shown.

Additional context

Not required, I think it's clear.

@engyebrahim
Copy link
Member

Thanks for feedback, the shadowing happens even across different assemblies, so having the same assemblyInit function should add the warning. you can change naming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants