Unhandled exception on adding reference to Excel

Bug reports.
deepalir
Posts: 3
Joined: Tue Feb 24, 2009 1:44 pm

Unhandled exception on adding reference to Excel

Post by deepalir » Wed Feb 25, 2009 7:44 am

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]

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Wed Feb 25, 2009 11:42 am

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

deepalir
Posts: 3
Joined: Tue Feb 24, 2009 1:44 pm

Post by deepalir » Wed Feb 25, 2009 11:54 am

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Wed Feb 25, 2009 3:07 pm

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