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

Key: RSRP-32873
Type: Exception Exception
Status: Open Open
Priority: Major Major
Assignee: Oleg Stepanov
Reporter: Alexander Nesterenko
Votes: 0
Watchers: 0
Operations

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

Unable to cast object of type 'JetBrains.ReSharper.Psi.CSharp.Impl.Tree.AccessorDeclaration' to type 'JetBrains.ReSharper.Psi.CSharp.Tree.IMethodDeclaration'.

Created: 01 Dec 06 19:40   Updated: 17 Jul 07 18:15
Component/s: Refactorings - Convert Method to Property
Fix Version/s: Future Versions
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Issue Links:
Duplicate
 
This issue is duplicated by:
RSRP-31312 JetBrains.ReSharper.Util.InternalErro... Normal Closed

Build: 312


 Description  « Hide
Previous exception:RSRP-32870
Build312, VS2005
JetBrains.ReSharper.Util.InternalErrorException: Unable to cast object of type 'JetBrains.ReSharper.Psi.CSharp.Impl.Tree.AccessorDeclaration' to type 'JetBrains.ReSharper.Psi.CSharp.Tree.IMethodDeclaration'.
An exception has occurred ---> System.InvalidCastException: Unable to cast object of type 'JetBrains.ReSharper.Psi.CSharp.Impl.Tree.AccessorDeclaration' to type 'JetBrains.ReSharper.Psi.CSharp.Tree.IMethodDeclaration'.
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.FunctionToPropertyRefactoring.ProcessMethod(IFunction method) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\convert\functiontoproperty\FunctionToPropertyRefactoring.cs:line 139
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.FunctionToPropertyRefactoring.ProcessMethods() in c:\Agent\work\ReSharper-Main\src\Refactorings\src\convert\functiontoproperty\FunctionToPropertyRefactoring.cs:line 132
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.FunctionToPropertyRefactoring.Execute() in c:\Agent\work\ReSharper-Main\src\Refactorings\src\convert\functiontoproperty\FunctionToPropertyRefactoring.cs:line 126
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.Impl.FunctionToPropertyRefactoringWorkflow.Execute(IProgressIndicator progressIndicator) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\convert\functiontoproperty\Impl\FunctionToPropertyRefactoringWorkflow.cs:line 84
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.RefactoringExecutor.Execute(IProgressIndicator progressIndicator) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 615
— End of inner exception stack trace —

at JetBrains.ReSharper.Util.Logger.LogExceptionEx(Exception, String, Boolean) in c:\Agent\work\ReSharper-Main\src\Util\src\Logger.cs:line 350 column 9
at JetBrains.ReSharper.Util.Logger.LogException(Exception) in c:\Agent\work\ReSharper-Main\src\Util\src\Logger.cs:line 362 column 5
at JetBrains.ReSharper.Refactorings.Workflow.RefactoringExecutor.Execute(IProgressIndicator) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 628 column 11
at JetBrains.ReSharper.Shell.Progress.TaskHelper.Run() in c:\Agent\work\ReSharper-Main\src\Shell\src\Progress\UITaskExecutor.cs:line 231 column 13
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object)
at System.Threading.ExecutionContext.runTryCode(Object)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, Object)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext, ContextCallback, Object)
at System.Threading.ExecutionContext.Run(ExecutionContext, ContextCallback, Object)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message&)
at System.Windows.Forms.ScrollableControl.WndProc(Message&)
at System.Windows.Forms.ContainerControl.WndProc(Message&)
at System.Windows.Forms.Form.WndProc(Message&)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)
at JetBrains.UI.Interop.Win32Declarations.DispatchMessage(MSG&)
at JetBrains.ReSharper.Shell.Progress.UITaskExecutor.RunMessageLoop() in c:\Agent\work\ReSharper-Main\src\Shell\src\Progress\UITaskExecutor.cs:line 127 column 11
at JetBrains.ReSharper.Shell.Progress.UITaskExecutor.ExecuteTask(TaskHelper, String, Boolean, Boolean&) in c:\Agent\work\ReSharper-Main\src\Shell\src\Progress\UITaskExecutor.cs:line 149 column 11
at JetBrains.ReSharper.Shell.Progress.UITaskExecutor.ExecuteTask(TaskWithProgress, String, Boolean&) in c:\Agent\work\ReSharper-Main\src\Shell\src\Progress\UITaskExecutor.cs:line 170 column 7
at JetBrains.ReSharper.Refactorings.Workflow.TaskExecutorWrapper.ExecuteTask(TaskWithProgress, String, Boolean&) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 479 column 9
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.ExecuteRefactoring(Object[]) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 422 column 9
at JetBrains.ReSharper.Psi.Impl.PsiManagerImpl.PsiManagerImpl.DoTransaction(TransactionHandler, Object[]) in c:\Agent\work\ReSharper-Main\src\Psi\src\impl\PsiManager\PsiManagerImpl.cs:line 324 column 9
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.TryExecuteRefactoring() in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 271 column 9
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.ShowNextPage() in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 165 column 13
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.MyForm_OnContinueClicked(Object, EventArgs) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 93 column 5
at JetBrains.ReSharper.Refactorings.Workflow.RefactoringWizardForm.myContinueButton_Click(Object, EventArgs) in c:\Agent\work\ReSharper-Main\src\Refactorings\src\Workflow\RefactoringWizardForm.cs:line 482 column 3
at System.Windows.Forms.Control.OnClick(EventArgs)
at System.Windows.Forms.Button.OnClick(EventArgs)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs)
at System.Windows.Forms.Control.WmMouseUp(Message&, MouseButtons, Int32)
at System.Windows.Forms.Control.WndProc(Message&)
at System.Windows.Forms.ButtonBase.WndProc(Message&)
at System.Windows.Forms.Button.WndProc(Message&)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)



 All   Comments   Work Log   Change History      Sort Order:
Valentin Kipiatkov - 28 Mar 07 17:40
Shouldn't it be fixed in 2.5.2?

Alexander Nesterenko - 29 Mar 07 09:48
I tries use "Method To Property" wneh i select get accessor.
public string Description
       {
           get { return description; }
           set { description = value; }
       }

In ReSharper 2.5.2 i gets following exception:

JetBrains.ReSharper.Util.InternalErrorException: Unable to cast object of type 'JetBrains.ReSharper.Psi.CSharp.Impl.Tree.AccessorDeclaration' to type 'JetBrains.ReSharper.Psi.CSharp.Tree.IMethodDeclaration'.
An exception has occurred ---> System.InvalidCastException: Unable to cast object of type 'JetBrains.ReSharper.Psi.CSharp.Impl.Tree.AccessorDeclaration' to type 'JetBrains.ReSharper.Psi.CSharp.Tree.IMethodDeclaration'.
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.FunctionToPropertyRefactoring.ProcessMethod(IFunction method) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\convert\functiontoproperty\FunctionToPropertyRefactoring.cs:line 139
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.FunctionToPropertyRefactoring.ProcessMethods() in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\convert\functiontoproperty\FunctionToPropertyRefactoring.cs:line 132
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.FunctionToPropertyRefactoring.Execute() in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\convert\functiontoproperty\FunctionToPropertyRefactoring.cs:line 126
at JetBrains.ReSharper.Refactorings.Convert.FunctionToProperty.Impl.FunctionToPropertyRefactoringWorkflow.Execute(IProgressIndicator progressIndicator) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\convert\functiontoproperty\Impl\FunctionToPropertyRefactoringWorkflow.cs:line 84
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.RefactoringExecutor.Execute(IProgressIndicator progressIndicator) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 615
— End of inner exception stack trace —

at JetBrains.ReSharper.Util.Logger.LogExceptionEx(Exception, String, Boolean) in c:\Agent\work\Server\ReSharper2.5\src\Util\src\Logger.cs:line 350 column 9
at JetBrains.ReSharper.Util.Logger.LogException(Exception) in c:\Agent\work\Server\ReSharper2.5\src\Util\src\Logger.cs:line 362 column 5
at JetBrains.ReSharper.Refactorings.Workflow.RefactoringExecutor.Execute(IProgressIndicator) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 628 column 11
at JetBrains.ReSharper.Shell.Progress.TaskHelper.Run() in c:\Agent\work\Server\ReSharper2.5\src\Shell\src\Progress\UITaskExecutor.cs:line 231 column 13
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object)
at System.Threading.ExecutionContext.runTryCode(Object)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, Object)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext, ContextCallback, Object)
at System.Threading.ExecutionContext.Run(ExecutionContext, ContextCallback, Object)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message&)
at System.Windows.Forms.ScrollableControl.WndProc(Message&)
at System.Windows.Forms.ContainerControl.WndProc(Message&)
at System.Windows.Forms.Form.WndProc(Message&)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)
at JetBrains.UI.Interop.Win32Declarations.DispatchMessage(MSG&)
at JetBrains.ReSharper.Shell.Progress.UITaskExecutor.RunMessageLoop() in c:\Agent\work\Server\ReSharper2.5\src\Shell\src\Progress\UITaskExecutor.cs:line 127 column 11
at JetBrains.ReSharper.Shell.Progress.UITaskExecutor.ExecuteTask(TaskHelper, String, Boolean, Boolean&) in c:\Agent\work\Server\ReSharper2.5\src\Shell\src\Progress\UITaskExecutor.cs:line 149 column 11
at JetBrains.ReSharper.Shell.Progress.UITaskExecutor.ExecuteTask(TaskWithProgress, String, Boolean&) in c:\Agent\work\Server\ReSharper2.5\src\Shell\src\Progress\UITaskExecutor.cs:line 170 column 7
at JetBrains.ReSharper.Refactorings.Workflow.TaskExecutorWrapper.ExecuteTask(TaskWithProgress, String, Boolean&) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 479 column 9
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.ExecuteRefactoring(Object[]) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 422 column 9
at JetBrains.ReSharper.Psi.Impl.PsiManagerImpl.PsiManagerImpl.DoTransaction(TransactionHandler, Object[]) in c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\PsiManager\PsiManagerImpl.cs:line 321 column 9
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.TryExecuteRefactoring() in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 271 column 9
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.ShowNextPage() in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 165 column 13
at JetBrains.ReSharper.Refactorings.Workflow.WorkflowProcessor.MyForm_OnContinueClicked(Object, EventArgs) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\WorkflowProcessor.cs:line 93 column 5
at JetBrains.ReSharper.Refactorings.Workflow.RefactoringWizardForm.myContinueButton_Click(Object, EventArgs) in c:\Agent\work\Server\ReSharper2.5\src\Refactorings\src\Workflow\RefactoringWizardForm.cs:line 482 column 3
at System.Windows.Forms.Control.OnClick(EventArgs)
at System.Windows.Forms.Button.OnClick(EventArgs)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs)
at System.Windows.Forms.Control.WmMouseUp(Message&, MouseButtons, Int32)
at System.Windows.Forms.Control.WndProc(Message&)
at System.Windows.Forms.ButtonBase.WndProc(Message&)
at System.Windows.Forms.Button.WndProc(Message&)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)


Alexander Nesterenko - 29 Mar 07 09:49
I tries use "Method To Property" wneh i select get accessor.
public string Description
       {
           get { return description; }
           set { description = value; }
       }

Build370, VS2005


Anonymous - 16 Apr 07 19:35
Trying to use "Convert Method to Property". Actually, I was longer for "Convert Property to Method", but it wasn't available and I tried "Property to Method" just to see if it would work.
Build340, VS2005

Anonymous - 07 Jun 07 14:02
Build326, VS2005