History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-3459
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Dmitry Lomov
Reporter: Ilya Ryzhenkov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ReSharper

Events outside of the class cannot be treated as delegates

Created: 05 Aug 06 00:16   Updated: 20 Jun 07 10:57
Component/s: PSI - Resolve
Fix Version/s: 4.0
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 88
Old URL: http://www.intellij.net/tracker/resharper/viewSCR?publicId=3459


 Description  « Hide
class MyBase
	{
		public event EventHandler MyEvent;

		private EventHandler _myCustomEvent;
		public event EventHandler MyCustomEvent
		{
			add
			{
				_myCustomEvent += value;
			}
			remove
			{
				_myCustomEvent -= value;
			}
		}

		void foo()
		{
			MyEvent.GetInvocationList();
			+MyCustomEvent.GetInvocationList();+
		}
	}


	class User
	{
		public static void Main(string[] args)
		{
			MyBase myBase = new MyBase();
			+MyCustomEvent.GetInvocationList();+
		}
	}

Underlined code is invalid. It is not marked as error in R#R. Moreover, R#R allows autocomplete after "myBase.MyEvent.". Only += and -= are allowed. Same in MyBase.foo(). Events with add/remove accessors cannot be treated as delegates, even inside declaring type.



 All   Comments   Work Log   Change History      Sort Order:
Ilya Ryzhenkov - 07 Aug 06 15:21
Re: #3459- Events outside of the class cannot be treated as delegates
Today I seem to be pretty inattentive )

Of course, in User.Main method last line should read

myBase.MyCustomEvent.GetInvocationList();


Ilya Ryzhenkov - 07 Aug 06 15:21
Re: #3459- Events outside of the class cannot be treated as delegates
I suppose priority of this CR should be increased because it affects auto-complete, not only error highlight.