Skip to content

Explicit Event Implementation Does Not Emit FQN #238

@JasonBock

Description

@JasonBock

To reproduce:

var code =
	"""
	using Rocks;
	using System;

	namespace EventStuff
	{
		public class Event : EventArgs { }
			
		public delegate void DomEventHandler(Object sender, Event ev);
	}

	namespace GlobalHandlers
	{
		public interface IGlobalEventHandlers
		{
			event global::EventStuff.DomEventHandler CanPlay;
		}
	}

	namespace Controllers
	{
		public interface IMediaController
		{
			event global::EventStuff.DomEventHandler CanPlay;
		}
	}
			
	namespace MockTests
	{
		public interface IHtmlMediaElement
			: global::GlobalHandlers.IGlobalEventHandlers, global::Controllers.IMediaController
		{
			void Foo();
		}
			
		public static class Test
		{
			public static void Generate()
			{
				var rock = Rock.Create<IHtmlMediaElement>();
			}
		}
	}
	""";

This wiil create errors like this:

error CS0535: 'CreateExpectationsOfIHtmlMediaElementExtensions.RockIHtmlMediaElement' does not implement interface member 'IMediaController.CanPlay'
error CS0535: 'CreateExpectationsOfIHtmlMediaElementExtensions.RockIHtmlMediaElement' does not implement interface member 'IGlobalEventHandlers.CanPlay'
error CS0246: The type or namespace name 'IGlobalEventHandlers' could not be found (are you missing a using directive or an assembly reference?)
error CS0538: 'IGlobalEventHandlers' in explicit interface declaration is not an interface
error CS0246: The type or namespace name 'IMediaController' could not be found (are you missing a using directive or an assembly reference?)
error CS0538: 'IMediaController' in explicit interface declaration is not an interface

The problem is the event implementation does not emit FQNs for the two interfaces.

This was found in AngleSharp.Html.Dom.IHtmlMediaElement.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions