vijayamadhavareddy / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

SqlServerCompactErrorLog fails to initialize database #216

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Below is an interactive IronPython session that demonstrates the issue:

IronPython 2.6.1 (2.6.10920.0) on .NET 4.0.30319.225
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> clr.AddReference('Elmah')
>>> from Elmah import *
>>> connstr = r'Data Source=C:\temp\errors.sdf'
>>> log = SqlServerCompactErrorLog(connstr)
>>> clr.AddReference('System.Data.SqlServerCe')
>>> from System.Data.SqlServerCe import *
>>> conn = SqlCeConnection(connstr)
>>> conn.Open()
>>> cmd = SqlCeCommand('SELECT * FROM ELMAH_Error', conn)
>>> reader = cmd.ExecuteReader()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
EnvironmentError: System.Data.SqlServerCe.SqlCeException (0x80004005): The 
specified table does not exist. [ ELMAH_Error ]
   at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.CallWithInstance(Object[] args, Boolean& shouldOptimize)
   at IronPython.Runtime.Types.BuiltinFunction.BuiltinMethodCaller`1.Call0(CallSite site, CodeContext context, TFuncType func)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at IronPython.Runtime.Types.BuiltinFunction.BuiltinMethodCaller`1.Call0(CallSite site, CodeContext context, TFuncType func)
   at IronPython.Compiler.Ast.CallExpression.Invoke0Instruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
   at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.<RunOneInteraction>b__0()
>>> cmd = SqlCeCommand('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES', conn)
>>> reader = cmd.ExecuteReader()
>>> clr.AddReference('System.Data')
>>> from System.Data import DataTable
>>> table = DataTable()
>>> table.Load(reader)
>>> print table.Rows.Count
0

What is the expected output? What do you see instead?

Expected non-existing errors.sdf to be created and initialized with an a single 
table called ELMAH_Error. Instead the errors.sdf is created uninitialized.

When SQL Server Compact ADO.NET objects are used to query the ELMAH_Error table 
directly then the error "The specified table does not exist. [ ELMAH_Error ]" 
is thrown instead.

Querying the error.sdf database schema yields 0 tables.

Additional information.

This issue was produced on release branch 1.2 (RB-1.2) and using r816.
The IronPython session above is also available in the attached ipy.txt file. 
Moreover, dbg.txt shows the output in the debugger while attached to the 
IronPython session. It shows that a first chance exception of type 
'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll

Original issue reported on code.google.com by azizatif on 17 Mar 2011 at 10:15

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in changset 817

Original comment by ejls...@hotmail.com on 18 Mar 2011 at 2:18

GoogleCodeExporter commented 9 years ago
Fixed in r817

Original comment by azizatif on 31 Mar 2011 at 7:47

GoogleCodeExporter commented 9 years ago
Issue 224 has been merged into this issue.

Original comment by azizatif on 29 Apr 2011 at 7:31