Exception with Subsonic 2.2, SQLite and Migrations - subsonic

I'm playing with Migrations and created a simple migration like
public class Migration001 : Migration
{
public override void Up()
{
TableSchema.Table testTable = CreateTableWithKey("TestTable");
}
public override void Down()
{
}
}
after executing sonic.exe migrate I'm getting the following output:
Setting ConfigPath: 'App.config'
Building configuration from c:\tmp\MigrationTest\MigrationTest\App.config
Adding connection to SQLiteProvider
Found 1 migration files
Current DB Version is 0
Migrating to 001_Init (1)
There was an error running migration (001_Init):
SQLite error
near "IDENTITY": syntax error
Stack Trace:
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] argum
ents, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle
typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] argume
nts, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwn
er)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisib
ilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
at SubSonic.CodeRunner.RunAndExecute(ICodeLanguage lang, String sourceCode, S
tring methodName, Object[] parameters) in D:\#SubSonic\SubSonic\SubSonic.Migrati
ons\CodeRunner.cs:line 95
at SubSonic.Migrations.Migrator.ExecuteMigrationCode(String migrationFile) in
D:\#SubSonic\SubSonic\SubSonic.Migrations\Migrator.cs:line 177
at SubSonic.Migrations.Migrator.Migrate() in D:\#SubSonic\SubSonic\SubSonic.M
igrations\Migrator.cs:line 141
Any hints?

You are probably the only one on the Earth planet to have tried this. I don't think the migration code was ever completed or tested with sqlite, as evidenced by the IDENTITY keyword that shouldn't be used with sqlite. Subsonic is highly sql server centric, so there are many changes required to get all the features working for other databases. There is an improved sqlite provider in one of the forks of subsonic2 on github, but subsonic2 is (currently) a dead project and no github pull requests are being honored.

Related

how can we run .net core c# Tesseract code on Linux

I have the following code to extract text from an image using Tesseract. This code is developed in .Net Core C# and is working perfectly fine on a windows machine, However this is not working on a linux servre.
What am i missing here? Do I need to install Tesseract (apt-get install tesseract) on the linux server, I did not install Tesseract on windows machine, the code is using the dll directly, I believe Linux machine too should use the dll references to execute the code.
Below is the code:
using (var engine = new TesseractEngine("tessdata_folder", "eng", EngineMode.Default))
{
using (var img = Pix.LoadFromFile(image_path))
{
/*
Remaining code goes here
*/
}
}
The code is failing at below line on Linux machine with this error Exception has been thrown by the target of an invocation.
The files in tessdata_folder are same the ones i used for windows machine, would these files cause the issue, If 'yes', where can i find linux compatible tessdata.
using (var engine = new TesseractEngine("tessdata_folder_path", "eng", EngineMode.Default))
Below is the full stack trace of the error.
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at InteropDotNet.InteropRuntimeImplementer.CreateInstance[T]()
at Tesseract.Interop.LeptonicaApi.Initialize()
at Tesseract.Interop.TessApi.Initialize()
at Tesseract.Interop.TessApi.get_Native()
at Tesseract.TesseractEngine..ctor(String datapath, String language, EngineMode engineMode, IEnumerable`1 configFiles, IDictionary`2 initialOptions, Boolean setOnlyNonDebugVariables)
at **web_api_controller_name**.OCRImage(String image_path, Int32 page_id, String page_img_path) in ***.cs file_name***:line 606

Pythonnet List<string> unable to convert type

I am using a .dll with python in order to send commands to a motion controller. The majority of requests are OK but I'm facing difficulties when trying the following:
from System.Collections.Generic import List
from System import String
result, response_list, err_string = SMC.ZT(1, List[String], "")
# The Error:
result, list_parameters, err_string = self.SMC.ZT(ctlr_address, List[String], err_string)
System.ArgumentException: Unable to convert type object 'System.RuntimeType' in type 'System.Collections.Generic.List`1[System.String]&'.
to System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
to System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
to System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
to System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
to Python.Runtime.MethodBinder.Invoke(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, MethodInfo[] methodinfo)
# Syntax from the docs:
# int ZT(int controllerAddress, out List<string> Parameters, out string errstring)
# controllerAddress: controllerAddress
# Parameters: Parameters
# errString: The failure reason
# return: 0 in success and -1 on failure

TargetInvocationException - Object reference not set to an instance of an object. for Automapper

I am Frequently seeing following error in Windows Event Viewer – Application Error Log. This is happening on Amazon Windows Server.
Web application is in the ASP.net MVC 5. I have recently updated NuGet package for solution just to overcome this error but error still exists.
Event code: 3005
Event message: An unhandled exception has occurred.
Event sequence: 22
Event occurrence: 9
Event detail code: 0
Application information:
Trust level: Full
Application Virtual Path: /
Application Path: WebApPath
Machine name: EC2AMAZ-TUK4T6L
Process information:
Process ID: 9628
Process name: w3wp.exe
Account name: IIS APPPOOL\ AppPoolName
Exception information:
Exception type: TargetInvocationException
Exception message: Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
Object reference not set to an instance of an object.
at AutoMapper.TypeMapFactory.<>c__DisplayClass3_0.<MapDestinationPropertyToSource>b__0(IMemberConfiguration _)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
at AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, IProfileConfiguration options, MemberList memberList)
at AutoMapper.ConfigurationStore.<>c__DisplayClass80_0.<CreateTypeMap>b__0(TypePair tp)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at AutoMapper.ConfigurationStore.CreateMap[TSource,TDestination](String profileName, MemberList memberList)
at AP.Web.Services.Services.CustInfoService..ctor(ICustInfoRepository repository)
Thread information:
Thread ID: 22
Thread account name: IIS APPPOOL\ AppPoolName
Is impersonating: False
Stack trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
Custom event details:
Not been able to determine why this error coming up. Your help will be greatly appreciated.
Thankyou,
Raj.

error processing a workflow SharePoint 2013

I did a workflow with visual studio workflow foundation
when I run the workflow from sharepoint gives me this error ... does anyone know how to repair the damage ?
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Value does not fall within the expected range.
at Microsoft.SharePoint.Utilities.SPUtility.Hex(Char ch)
at Microsoft.SharePoint.SPContentTypeId..ctor(String id)
at Microsoft.SharePoint.Workflow.SPWinOETaskService.CreateTaskWithContentType(Guid taskId, SPWorkflowTaskProperties properties, String taskContentTypeId, HybridDictionary specialPermissions) --- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Workflow.Activities.CallExternalMethodActivity.Execute(ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
at System.Workflow.Runtime.Scheduler.Run()
Without seeing your source code its hard to know for sure what caused the issue, but it looks like you tried to make an unsafe update without using the AllowUnsafeUpdates() function. Updating the Author field on a list item would require this, for example but there are a number of reasons you might need it.
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

SPWeb disposing himself and causing exception

When trying to use SPWeb.GetSiteData(SPSiteDataQuery) (Trying to bind some data to SPGridView), it throws me an TargetInvocationException with a following stacktrace:
Exception
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.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at Balticovo.SharePoint.WebParts.CrossSiteDataQueryWebPart.OnLoad(EventArgs e)
The method that is being invocated is GetData. After investigating InnerException with message Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)) it looks like SharePoint want to release resources somwhere:
at Microsoft.SharePoint.Library.SPRequest.ReleaseResources()
at Microsoft.SharePoint.SPRequestManager.Release(SPRequest request)
at Microsoft.SharePoint.SPWeb.Invalidate()
at Microsoft.SharePoint.SPWeb.Close()
at Microsoft.SharePoint.SPWeb.Dispose()
at Balticovo.SharePoint.Extensions.GetCrossSiteData(SPWebApplication webApp, SPCrossSiteDataQuery query)
at Balticovo.SharePoint.TasksTableAdapter.GetData(Guid queryId, Boolean dataForOutlook)
at Balticovo.SharePoint.TasksTableAdapter.GetData(Guid queryId)
But all those methods up to SPWeb.Dispose() I don't dispose anything before I call SPWeb.GetSiteData(SPSiteDataQuery) which then throws an exception.
My Code
Instance of SPWebApplication i get like this - Microsoft.SharePoint.WebControls.SPControl.GetContextWebApplication(HttpContext.Current);
Then i do some stuff like this in function GetCrossSiteData:
foreach (string siteUrl in query.QuerySites)
{
try
{
using (SPSite site = new SPSite(siteUrl))
using (SPWeb web = site.OpenWeb())
{
DataTable dt = web.GetSiteData(query.SiteDataQuery); //Hangs here
....
}
}
}
Any ideas? Thank you.
Turns out that the cause was that for some lists TemplateFeatureId property was set to a template that does not really exist or was changed in some way. As in my case i just recreated those lists and now queries are running fine.
Found this out by this article: http://blog.myitechnology.com/2009/06/fixing-feature-guid-for-list-template.html
Just DO NOT USE that tool to fix the problem - he say's he's modifying the content database (i suppose directly). That's a no-no-no. I just used it to see which lists have the problem.

Resources