Options

3.5 RC Unhandled Exception

rgribblergribble Posts: 88
edited July 23, 2007 5:31AM in SQL Prompt Previous Versions
I opened Query Analyzer and connected to a server.

I had set this server's "master" database in the "Connection to Ignore" under SQLPrompt Options

Once Query Analyzer was up (and still pointing at the default master database), i selected a .sql script to load from the "recent files" menu. The script i opened makes mention of other databases on the server, using cross database coding (Database..Table) notation.

This caused SQL Prompt to throw an unhandled exception. Furthermore, if i hit "continue" it keeps throwing exceptions whenever i click anywhere in the script text

I also tested this by opening the script by drag-dropping it into QA, rather than using Recent Files menu, and the exception occurs then as well.

I then removed the master database from the ignored connection options, and everything works OK - SQLPrompt loads/refreshes the master database cache when QA first opens up, then when i open the script from the recent used files menu, SQLPrompt caches the other 2 databases that are mentioned in the script and everything is happy.

So this bug appears to be caused by ignoring the master database, which i thought should be OK to do as i never do anything with master, yet SQLPrompt always caches it because QA always starts off with it selected.


Here are the details of the exception:

An unhandled exception occured, with the following details:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: This class can only be used to resolve objects whose server and database is known. Unable to resolve object [Wagon]..[GlobalInt].
Parameter name: name
at _15._1(_139 , Boolean )
at _15._1(SqlPromptEngine , _139 , Boolean )
at _61.PopulateTargetTables(SqlPromptEngine engine, _139 objectName, _116 aliasSource, Boolean useCurrent)
at _127..ctor(SqlPromptEngine engine, ISqlInfo parent, _137 astMap, Element statementAst)
at _113.PopulateCandidateLists(_137 astMap, Element statementAst, Element caretAst)
at RedGate.SqlPrompt.Engine.SqlPromptEngine.UpdateCandidateLists()
at RedGate.SqlPrompt.Engine.SqlPromptEngine._2(Object , FitPropertyChangeEventArgs )
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at RedGate.Util.EventHandlerSet._1.Fire(Object eventKey, Object sender, EventArgs args)
at _150._1(CaretPosition , CaretPosition )
at _150.set_CaretPosition(CaretPosition value)
at RedGate.SqlPrompt.Engine.SqlPromptEngine.set_CaretPosition(CaretPosition value)
at RedGate.SqlPrompt.Engine.SqlPromptEngine._1(String , CaretPosition , Boolean , Int32 , Int32 )
at RedGate.SqlPrompt.Engine.SqlPromptEngine.SetSqlScriptProvider(IScriptProvider provider, CaretPosition caretPosition)
at _9._1(CaretPosition )
at _7._1(CaretPosition )
at _4._1(CaretPosition )
at _4._1()
at _4._2(Object , _3 )
at _7._3(Object , _3 )
at _8.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
RedGate.SQLPrompt.QueryAnalyzerUI
Assembly Version: 3.5.0.323
Win32 Version: 3.5.0.323
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.SQLPrompt.QueryAnalyzerUI.exe
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
RedGate.SQLPrompt.CommonUI
Assembly Version: 3.5.0.323
Win32 Version: 3.5.0.323
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.SQLPrompt.CommonUI.DLL
RedGate.Licensing.Client
Assembly Version: 1.3.3.2
Win32 Version: 1.3.3.2
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.Licensing.Client.DLL
RedGate.SqlPrompt.Engine
Assembly Version: 3.5.0.323
Win32 Version: 3.5.0.323
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.SqlPrompt.Engine.DLL
log4net
Assembly Version: 1.2.10.0
Win32 Version: 1.2.10.0
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/log4net.DLL
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
RedGate.SQL.Shared
Assembly Version: 6.0.0.95
Win32 Version: 6.0.0.95
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.SQL.Shared.DLL
RedGate.SqlPrompt.Engine.Gatekeeper
Assembly Version: 3.5.0.323
Win32 Version: 3.5.0.323
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.SqlPrompt.Engine.Gatekeeper.DLL
RedGate.Shared.Utils
Assembly Version: 6.0.0.95
Win32 Version: 6.0.0.95
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.Shared.Utils.DLL
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
RedGate.SQLCompare.Engine
Assembly Version: 5.8.1.31
Win32 Version: 5.8.1.31
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.SQLCompare.Engine.DLL
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
RedGate.SQLCompare.ASTParser
Assembly Version: 5.8.1.31
Win32 Version: 5.8.1.31
CodeBase: file:///C:/Program%20Files/Red%20Gate/SQL%20Prompt%203/RedGate.SQLCompare.ASTParser.DLL

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Comments

  • Options
    Bart ReadBart Read Posts: 997 Silver 1
    Hi there,


    Thanks for posting this. The problem here is not that you're ignoring the master database, but that you're ignoring the default database for your connection, which probably is master. SQL Prompt then doesn't know which server any of these databases are on since it grabs that information from the first database you connect to, although it should handle the situation more gracefully than this.

    The best thing I can suggest is to do what you have done: allow SQL Prompt to cache the master database, and then all will work fine. We'll tidy this up though because it's a bit unpleasant to throw an unhandled exception.


    Thanks,
    Bart
    Bart Read
    Principal Consultant
    bartread.com Ltd
Sign In or Register to comment.