Skip to content

[Obsolete] Types Are Not Flagged #250

@JasonBock

Description

@JasonBock

To reproduce:

var code =
	"""
	using Rocks;
	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Linq;
									
	#nullable enable

	namespace MockTests
	{
		[Obsolete("Do not use this", true)]
		public interface IServerComponent
		{
			void Execute();
		}

		public abstract class JobStorage
		{
			public virtual IEnumerable<IServerComponent> GetComponents() =>
				Enumerable.Empty<IServerComponent>();
		}

		public static class Test
		{
			public static void Generate()
			{
				var rock = Rock.Create<JobStorage>();
			}
		}
	}
	""";

This will produce errors like this:

error CS0619: 'IServerComponent' is obsolete: 'Do not use this'

We need to consider if the type itself is considered obsolete from the different member parts. Note that we're already checking the target type for a mock to see if it's obsolete.

This was found on Hangfire.JobStorage.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions