Database error, cant run SA

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, Alex.Davies, melvyn.harbour

Database error, cant run SA

Postby Uniwares_AS » Thu Sep 09, 2010 8:42 pm

No idea what might cause this error, but here it is:

Error 4 SmartAssembly build failed:
Unable to connect to the database for the following reason:
ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.

If the database is on a network, please verify the network connection.
If the problem persists, restart SmartAssembly and try again.


I just installed the latest build (over an existing installation) and tried to build.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Uniwares_AS » Thu Sep 09, 2010 8:45 pm

Now that is weird, running SA in the build task I get this error, standalone it works.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Alex.Davies » Fri Sep 10, 2010 1:26 pm

Interesting. When you say the latest build, do you mean the 5.5 EAP, or 5.1?
Alex
Developer,
Red Gate .NET Tools
Alex.Davies
 
Posts: 335
Joined: Tue Dec 02, 2008 12:23 pm
Location: Cambridge, uk

Postby Uniwares_AS » Fri Sep 10, 2010 2:08 pm

Sorry, forgot to mention it: its 5.5.114 because it solves the problem I have with 5.1 (see F0038426)

To make things more interesting, I have a VM which is a clone of my dev machine which I use for testing sometimes, just installed 5.5 there, and it works fine in both build and standalone.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Uniwares_AS » Mon Sep 13, 2010 6:26 pm

Still trying to make it work, to no avail yet.

Some more details:

Tracing it with procmon, I see accesses to

Code: Select all
C:\\Program Files\\Red Gate\\SmartAssembly 5\\FSharp\\Windows
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Test
C:\\Program Files\\Red Gate\\SmartAssembly 5\\Modeling
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Windows
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Web
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Workflow
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Cloud
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Reporting
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Silverlight
C:\\Program Files\\Red Gate\\SmartAssembly 5\\FSharp\\Silverlight
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Office\\Version2007
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\Office\\Version2010
C:\\Program Files\\Red Gate\\SmartAssembly 5\\CSharp\\WCF


C:\\Program Files\\Red Gate\\SmartAssembly 5\\OpenSesame123.settings
C:\\Program Files\\Red Gate\\SmartAssembly 5\\SmartAssembly.settings


But thats it, no tries to access the database, nada, nyet.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Solved?

Postby Uniwares_AS » Mon Sep 13, 2010 10:26 pm

I just updated to the latest EAP build (121) and everything is back to normal. Whatever was wrong in build 114, its gone in 121.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Uniwares_AS » Mon Sep 20, 2010 8:31 pm

Hum, had the same problem again, with the version that worked last time and again, after updating to the latest 5.5 release its now working. Would be really great to figure out what could cause this.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Uniwares_AS » Tue Oct 19, 2010 6:31 pm

Am now back to the same problem. Can you give me ANY hint what might cause this? For the moment I am unable to do any release builds because of this slight problem.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Alex.Davies » Wed Oct 20, 2010 12:05 pm

Hia,
It's interesting, we improved the handling of the database connection dropping out in 5.5, so that it was meant to reconnect correctly.

But I think you're saying that this happens reliably, which suggests that perhaps something is actively closing the database connection. You're using it from an MSBuild task, perhaps you're invoking SA twice, and some kind of timeout is happening in between times? Using SA twice from one MSBuild process will reuse the database connection.

Perhaps a timeout can be configured at your SQL server. If not, perhaps switching to using the command line from an MSBuild Exec task may work, as then a completely separate instance of SA is used, which will have a separate database connection, so can't time out.

Hope that helps,
Alex
Developer,
Red Gate .NET Tools
Alex.Davies
 
Posts: 335
Joined: Tue Dec 02, 2008 12:23 pm
Location: Cambridge, uk

Postby Uniwares_AS » Wed Oct 20, 2010 1:16 pm

If I would use SQL server that would be no problem, but I am NOT. SA is using its own local database.

Yes, SA is invoked from a MS Build task, but it doesn't even complete the first run successfully, so there in no explanation why the connection would be closed as it doesn't even open one.

Edit: even if only one assembly is processed in the MSbuild task the same error occurs.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Alex.Davies » Wed Oct 20, 2010 3:18 pm

I'm afraid I can't think of any other reasons it might happen, and without being able to reproduce it in the main UI to get a better error message, I can't help further.

I suggest you work around it by using the command line tool and the Exec MSBuild task
Code: Select all
  <Target Name="AfterCompile">
    <Exec Command="C:\\Program Files\\Red Gate\\SmartAssembly 5\\SmartAssembly.com MyApplication.saproj" />
  </Target>
Alex
Developer,
Red Gate .NET Tools
Alex.Davies
 
Posts: 335
Joined: Tue Dec 02, 2008 12:23 pm
Location: Cambridge, uk

Postby Uniwares_AS » Wed Oct 20, 2010 4:01 pm

That's not too pleasing. Aren't there any extra/hidden logging features that I might turn on?

What amazes me is that I don't see it even trying to access the database file, so SQLite seems to throw the error for some unknown reason. There are no file accesses to the database ever when run in the MSBuild task. Yet the GUI or commandline works just fine.
Might this be related to some assembly in the GAC? Maybe the build task loads some assembly it should not, or it doesn't at all?
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Alex.Davies » Wed Oct 20, 2010 4:04 pm

No, sorry, there's no logging that would be useful here.

There's no assembly in the GAC that might have any effect here.
Alex
Developer,
Red Gate .NET Tools
Alex.Davies
 
Posts: 335
Joined: Tue Dec 02, 2008 12:23 pm
Location: Cambridge, uk

Postby Uniwares_AS » Wed Oct 20, 2010 6:26 pm

Let me ask you something stupid: where would you expect SmartAssembly.MSBuild.Tasks.dll to be? And what version should the latest one be?

I have SA 5.5.0.121 installed here.

Having turned on fusion logging, I see the following happening:
At installation time:
Code: Select all
*** Assembly Binder Log Entry  (20/10/2010 @ 14:19:08) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\mscorwks.dll
Running under executable  C:\\{7D3B8626-1726-4725-A40E-4426BDA46046}\\redgate.installerwizard.ui.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = LEON3\\as
LOG: DisplayName = RedGate.InstallerWizard.Engine.XmlSerializers, Version=1.6.0.8, Culture=neutral, PublicKeyToken=7f465a1c156d4d57, processorArchitecture=MSIL
 (Fully-specified)
LOG: Appbase = file:///C:/{7D3B8626-1726-4725-A40E-4426BDA46046}/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = redgate.installerwizard.ui.exe
Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.
LOG: Post-policy reference: RedGate.InstallerWizard.Engine.XmlSerializers, Version=1.6.0.8, Culture=neutral, PublicKeyToken=7f465a1c156d4d57, processorArchitecture=MSIL
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/{7D3B8626-1726-4725-A40E-4426BDA46046}/RedGate.InstallerWizard.Engine.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/{7D3B8626-1726-4725-A40E-4426BDA46046}/RedGate.InstallerWizard.Engine.XmlSerializers/RedGate.InstallerWizard.Engine.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/{7D3B8626-1726-4725-A40E-4426BDA46046}/RedGate.InstallerWizard.Engine.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/{7D3B8626-1726-4725-A40E-4426BDA46046}/RedGate.InstallerWizard.Engine.XmlSerializers/RedGate.InstallerWizard.Engine.XmlSerializers.EXE.
LOG: All probing URLs attempted and failed.


Then during build:
Code: Select all
*** Assembly Binder Log Entry  (20/10/2010 @ 14:20:40) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:  C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\clr.dll
Running under executable  C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\devenv.exe
--- A detailed error log follows.

LOG: IJW explicit bind. File path:C:\\Program Files\\Red Gate\\SmartAssembly 5\\SmartAssembly.exe.
LOG: IJW assembly bind returned file not found.

and
Code: Select all
*** Assembly Binder Log Entry  (20/10/2010 @ 14:20:40) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\clr.dll
Running under executable  C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\devenv.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = LEON3\\as
LOG: DisplayName = SmartAssembly, Version=5.5.0.153, Culture=neutral, PublicKeyToken=7f465a1c156d4d57
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = devenv.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\devenv.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\config\\machine.config.
LOG: Post-policy reference: SmartAssembly, Version=5.5.0.153, Culture=neutral, PublicKeyToken=7f465a1c156d4d57
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).


In comparism, running SA from the commandline, I get the following, but the build succeeds:
Code: Select all

*** Assembly Binder Log Entry  (20/10/2010 @ 14:24:30) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\mscorwks.dll
Running under executable  C:\\Program Files\\Red Gate\\SmartAssembly 5\\SmartAssembly.com
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = LEON3\\as
LOG: DisplayName = {425b630c-f30d-452a-a8e4-326d72bc5f28}, PublicKeyToken=3e56350693f7355e
 (Partial)
LOG: Appbase = file:///C:/Program Files/Red Gate/SmartAssembly 5/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : SmartAssembly, Version=5.5.0.153, Culture=neutral, PublicKeyToken=7f465a1c156d4d57.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files/Red Gate/SmartAssembly 5/{425b630c-f30d-452a-a8e4-326d72bc5f28}.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Red Gate/SmartAssembly 5/{425b630c-f30d-452a-a8e4-326d72bc5f28}/{425b630c-f30d-452a-a8e4-326d72bc5f28}.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Red Gate/SmartAssembly 5/{425b630c-f30d-452a-a8e4-326d72bc5f28}.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Red Gate/SmartAssembly 5/{425b630c-f30d-452a-a8e4-326d72bc5f28}/{425b630c-f30d-452a-a8e4-326d72bc5f28}.EXE.
LOG: All probing URLs attempted and failed.


Hope you are smarter than me.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Alex.Davies » Thu Oct 21, 2010 9:54 am

SmartAssembly.MSBuild.Tasks.dll lives in the GAC and should have a file version of whichever build you have installed (5.5.0.153) but an assembly version of 5.0.0.0

If it got as far as giving the error about the database connection, all assemblies must have loaded fine.
Alex
Developer,
Red Gate .NET Tools
Alex.Davies
 
Posts: 335
Joined: Tue Dec 02, 2008 12:23 pm
Location: Cambridge, uk

Next

Return to SmartAssembly 5

Who is online

Users browsing this forum: No registered users and 2 guests