Page 1 of 1

Unhandled exception on adding reference to Excel

Posted: Wed Feb 25, 2009 7:44 am
by deepalir
When trying to add a reference to MS Excel, the following exception ocurred:
(Note that while I am using an XP machine with SP2, the OS version reported is NT)

Ranorex Studio Version : 2.0.0.5474
.NET Version : 2.0.50727.1433
OS Version : Microsoft Windows NT 5.1.2600 Service Pack 2
Current culture : English (United Kingdom) (en-GB)
Current UI language : en-US
Working Set Memory : 121888kb
GC Heap Memory : 28898kb

Exception thrown:
System.IO.IOException: The process cannot access the file 'C:\Documents and Settings\deepalir\My Documents\RanorexStudio Projects\notepad_test\notepad_test\notepad_test.csproj' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)
at Microsoft.Build.BuildEngine.Project.Save(String projectFileName, Encoding encoding)
at Microsoft.Build.BuildEngine.Project.Save(String projectFileName)
at ICSharpCode.SharpDevelop.Project.MSBuildBasedProject.Save(String fileName)
at ICSharpCode.SharpDevelop.Project.AbstractProject.Save()
at ICSharpCode.SharpDevelop.Project.Commands.AddReferenceToProject.Run()
at ICSharpCode.Core.WinForms.MenuCommand.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

---- Recent log messages:
Failed to append recent log messages.
System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at ICSharpCode.SharpDevelop.Sda.LogMessageRecorder.AppendRecentLogMessages(StringBuilder sb, ILog log)
at ICSharpCode.SharpDevelop.Sda.ExceptionBox.getClipboardString()

---- Post-error application state information:
Installed 3rd party AddIns:
Workbench.ActiveContent: ICSharpCode.SharpDevelop.Gui.CompilerMessageView
ProjectService.OpenSolution: [Solution: FileName=C:\Documents and Settings\deepalir\My Documents\RanorexStudio Projects\notepad_test\notepad_test.rxsln, HasProjects=True, ReadOnly=False]
ProjectService.CurrentProject: [CSharpProject: notepad_test]

Posted: Wed Feb 25, 2009 11:42 am
by Support Team
Can you reproduce this behavior every time you add a reference to "Microsoft Office Excel"?
Can you please download the latest Ranorex release V2.0.1 and try again?

Regards,
Alex
Ranorex Support Team

Posted: Wed Feb 25, 2009 11:54 am
by deepalir
With version 2.0.1, the exception does not occur.

However after adding the reference, the following error is seen:

${res:MainWindow.CompilerMessages.CreatingCOMInteropAssembly}
Build started.
Build finished successfully. (00:00:01.4329736)
Error loading code-completion information for Excel from Excel:
Could not find assembly file.

Posted: Wed Feb 25, 2009 3:07 pm
by Support Team
You should set a reference to Microsoft.Office.Interop.Excel in the GAC list, as the automatic creation of an office com Interop dll is not possible. This also goes for Microsoft Visual Studio. The Interop assemblies can be installed with the office insulation or downloaded from Microsoft at : http://www.microsoft.com/downloads/deta ... aylang=en.

Thanks,

Ron
Ranorex Support Team