OleDB in Pythonnet and Mono on Mac OS X - c#

I am trying to run several method of a dll library that I own. I use pythonnet 3.0.0dev, python3.9 and Mono 6.10.0. One of the methods triggers creating an .mdb file. On a windows machine I've install Microsoft Access Database Engine (suggested by the dll provider) and I could run my script without any problem. However, doing the same on a Mac OS X triggers the following error:
NotImplementedException: OleDb is not implemented.
at System.Data.OleDb.OleDbConnection..ctor () [0x0000b] in <bd12f551d3b343c5a146c906291931e8>:0
at (wrapper remoting-invoke-with-check) System.Data.OleDb.OleDbConnection..ctor()
at Csu.Modsim.NetworkUtils.DBUtil.OpenDBConnection () [0x0000b] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.NetworkUtils.DBUtil.Create (System.Boolean Overwrite, System.Boolean LeaveOpen) [0x00026] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.NetworkUtils.ModelOutputMSDB.InitializeOutput () [0x000a6] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.NetworkUtils.ModelOutputSupport.FlushOutputToCSV (Csu.Modsim.ModsimModel.Model mi, System.Boolean finalizeOutput) [0x0030d] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.ModsimModel.GlobalMembersOperate.operate (Csu.Modsim.ModsimModel.Model mi, Csu.Modsim.ModsimModel.Model mi2) [0x012ab] in <6f164bf9bd4744b9a0c1e4daaabc0e8a>:0
at Csu.Modsim.ModsimModel.Modsim.RunSolver (Csu.Modsim.ModsimModel.Model mi) [0x002f7] in <6f164bf9bd4744b9a0c1e4daaabc0e8a>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <55adae4546cd485ba70e2948332ebe8c>:0
What could be a possible solution to this problem. All my installed components are 64-bit.
Thanks

Related

Xamarin Form Encoding issue [duplicate]

I am working on an application in Xamarin for Visual Studio 2017. I am attempting to test my application on Android and iOS live player devices.
When I try to run it, I get the following error on my device (Android and iOS):
Level=Error, Title=Visualization Error, Message=Encoding 1252 data
could not be found. Make sure you have correct international codeset
assembly installed and enabled. (NotSupportedException)
I have found similar issues through Google searching, but after making the changes, it still will not run. I have checked all Internationalization options for both devices, and I have even saved directly as UTF-8 encoding, as I figured it may be an issue with encoding windows-1252. I also referenced the I18N.dll to the I18N.West.dll for both.
Any help would be greatly appreciated. Thank you.
Update:
I have been able to narrow down the issue further.
using (SqlConnection sqlConn = new
SqlConnection(Configuration.ConnectionString))
{
//sqlConn.Open();
}
The .open was causing the encoding error. After commenting it out, the app will run on the live device, however, I now get:
Level=Error, Title=Uncaught Exception, Message=Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled. (NotSupportedException)
And Visual Studio 2017 throws the following error
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
at
using (SqlConnection sqlConn = new
SqlConnection(Configuration.ConnectionString))
It occurs the moment it tries to pull from the database at the using statement above. I am using SQL Server 2008 R2. All I can tell is that it is having an issue with sending to and receiving from the SQL Server with Android and iOS.
Update 2:
After using some Exception Handlers, I boiled it down to this inner exception:
{System.NotSupportedException: Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at Mono.Data.Tds.TdsCharset.GetEncodingFromSortOrder (System.Int32 sortId) [0x00022] in :0
at Mono.Data.Tds.TdsCharset.GetEncodingFromSortOrder (System.Byte[] collation) [0x00006] in :0
at Mono.Data.Tds.TdsCharset.GetEncoding (System.Byte[] collation) [0x00008] in :0
at Mono.Data.Tds.Protocol.Tds.ProcessEnvironmentChange () [0x00229] in :0
at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x00129] in :0
at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00039] in :0
at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00000] in :0
at Mono.Data.Tds.Protocol.Tds70.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x0058e] in :0
at Mono.Data.Tds.Protocol.Tds80.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x00000] in :0
at System.Data.SqlClient.SqlConnection.Open () [0x00245] in <868a6461786e4884ac572c5e90a6b7fd>:0
at System.Data.Common.DbDataAdapter.QuietOpen (System.Data.IDbConnection connection, System.Data.ConnectionState& originalState) [0x0000c] in <868a6461786e4884ac572c5e90a6b7fd>:0
at System.Data.Common.DbDataAdapter.FillInternal (System.Data.DataSet dataset, System.Data.DataTable[] datatables, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) [0x0002d] in <868a6461786e4884ac572c5e90a6b7fd>:0
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) [0x00069] in <868a6461786e4884ac572c5e90a6b7fd>:0
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet) [0x00029] in <868a6461786e4884ac572c5e90a6b7fd>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 }
Which occurs at:
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
From the "iOS Build" Project Options page in Visual Studio for Mac you should check "west" checkbox. Same for Android properties.
In the the Android project, go to Properties -> Android Options
Then Linker Options, in the "Additional supported encodings" check "West".
For VS2019, on windows : Check : 'Additional Supported Encodings'

MissingMethodException in Xamarin.Forms project

I am developing an app using Xamarin.Forms. I have a method which returns all properties of a given object as a string.
public static string GetAllProperties(this object obj)
{
return string.Join(" ", obj
.GetType()
.GetRuntimeProperties()
.Select(prop => prop.GetValue(obj)));
}
It works fine on iOS and UWP, but throws a MissingMethodException on Android when accessing IsTransient property of the given object.
[0:] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Attempted to access a missing method.
at (wrapper managed-to-native) System.Exception:nIsTransient (int)
at System.Exception.get_IsTransient () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004b] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00038] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Reflection.PropertyInfo.GetValue (System.Object obj) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at Fantom.Helpers.Global.GetAllProperties (System.Object obj) [0x00034] in ...
at Fantom.ViewModel.SignUpViewModel+<<FirebaseSignUp>b__20_0>d.MoveNext () [0x00340] in ...
I tried the following with no luck.
Cleaning the solution and restarting Visual Studio.
Changing the .NET framework for the PCL project from 4.5.1 to 4.6 (Project Properties > Library > Targeting > Change...), but even though 4.6 is listed it doesn't let me pick it.
Making sure the latest version of Xamarin NuGet packages are installed on each platform project.
I don't think it would help diagnose the problem, but I have the following NuGet packages installed in the PCL project.
Firebase.Xamarin
Humanizer
Microsoft.Bcl
Microsoft.Bcl.Build
Microsoft.Net.Http
Newtonsoft.Json
PCLAppConfig
PCLStorage
Rx-Core, Rx-Interfaces, Rx-Linq, Rx-Main, Rx-PlatformServices
Xamarin Forms
Platform projects only have the Xamarin packages installed.

UITest failed with : "SetUp : System.InvalidOperationException"

I can't use UITest anymore with my xamarin project since the last update of xamarin on the stable channel with Xcode 8.2.
Everytime, when I launch the test, I have an error : "SetUp : System.InvalidOperationException : Sequence contains no matching element". My test series doesn't change from a long time and works well before...
So I don't know how to correct this problem now...
The stack trace :
at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) [0x00065] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:965
at Xamarin.UITest.iOS.Instruments.GetAutomationTemplatePath () [0x00031] in :0
at Xamarin.UITest.iOS.Instruments.StartInstrumentsInternal (System.String targetApplication, Xamarin.UITest.iOS.iOSRunType runType, System.String deviceId, System.String runLoopPath, Xamarin.UITest.Configuration.AppDataMode appDataMode, System.Predicate`1[T] dropLine) [0x00006] in :0
at Xamarin.UITest.iOS.Instruments.StartInstruments (System.String targetApplication, Xamarin.UITest.iOS.iOSRunType runType, System.String deviceId, Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00012] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.RunAppInEmulatorInternal (System.String application, Xamarin.UITest.iOS.Instruments instruments, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Uri deviceUri, Xamarin.UITest.Shared.Artifacts.ArtifactFolder artifactFolder, Xamarin.UITest.Configuration.AppDataMode appDataMode, System.String deviceIdentifier) [0x00095] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.RunAppInEmulator (Xamarin.UITest.Shared.iOS.AppBundle appBundle, Xamarin.UITest.iOS.Instruments instruments, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Uri deviceUri, Xamarin.UITest.Shared.Artifacts.ArtifactFolder artifactFolder, Xamarin.UITest.Configuration.AppDataMode appDataMode, System.String deviceIdentifier) [0x00099] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.LaunchApp (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, Xamarin.UITest.TestCloud.TestCloudiOSAppConfiguration testCloudAppConfiguration, Xamarin.UITest.Shared.Http.HttpClient testCloudWsClient) [0x000e4] in :0
at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x002db] in :0
at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in :0
at Ac.Test.TestV35.BeforeEachTest () [0x00012] in /Users/ShaprAdmin/Documents/ac/Ac.Test/TestV35.cs:17
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
Thank you!
try to grab the newest Xcode and
then beside proper NUnit version (2.6.x and proper NUnitTestAdapter 2.1.0)
try do upgrade/downgrade the Xamarin.UITest package to version 2.5.
For me it was not working (with same error) for 2.7 for 2.5 it's ok.
Regards,

ServiceStackHost.Instance has already been set

I have a bizarre problem.
I have implemented a standard Service Stack API.
It has been working perfect for the last year now.
Last week I saw some major changes to Xamarin Studio so decided to update my IDE.
With that update NuGet comes standard, so I decided to convert my Service Stack Reference Files to use NuGet. Quite nice, now I can update the DLL's etc with 1 click.
So the API works fine on my Windows Machine now, no issues.
Problem: Our servers run Ubuntu with Mono installed. And it does not want to budge.
I Initially get this Error:
System.TypeLoadException: A type load exception has occurred.
at ServiceStack.VirtualPath.FileSystemVirtualPathProvider..ctor (IAppHost appHost, System.IO.DirectoryInfo rootDirInfo) [0x00000] in <filename unknown>:0
at ServiceStack.VirtualPath.FileSystemVirtualPathProvider..ctor (IAppHost appHost, System.String rootDirectoryPath) [0x00000] in <filename unknown>:0
at ServiceStack.ServiceStackHost.Init () [0x00000] in <filename unknown>:0
at API_NOTIFICATION.Global.Application_Start (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Then I refresh the page and I keep getting this error:
System.IO.InvalidDataException: ServiceStackHost.Instance has already been set
at ServiceStack.ServiceStackHost.Init () [0x00000] in <filename unknown>:0
at API_NOTIFICATION.Global.Application_Start (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Anyone Experienced this before? Anyone know how to fix this?
I did look at other posts similar to this one.
No idea where to find:
App_Start/ServiceStackFramework.cs
And no idea how to remove as again I cant find that anywhere. But who knows, it might not even be the same problem at all.
I have used the standard Tutorial to set up the API which is posted on the ServiceStack Website.
Any help will be much appreciated. And like I said, the only think that really changed is the IDE and updating those ServiceStack references via NuGet.
AppHost:
public class ResponseNotificationServiceAppHost : AppHostBase
{
public ResponseNotificationServiceAppHost() : base("Response Notification Services", typeof(NotificationServices).Assembly)
{
}
#region implemented abstract members of AppHostBase
public override void Configure(Funq.Container container)
{
}
#endregion
}
Global:
public class Global : System.Web.HttpApplication
{
protected void Application_Start(Object sender, EventArgs e)
{
new ResponseNotificationServiceAppHost().Init();
}
}
API Service Class:
public class NotificationServices : Service
{
public PersonNotificationResponse Any(PersonNotification request)
{
// Implementation Code here
}
}
Update:
When trying to remove the AppHost, the API would not load. I get the following error on the Ubuntu Server:
System.NullReferenceException: Object reference not set to an instance of an object
at ServiceStack.HttpHandlerFactory..cctor () [0x00000] in <filename unknown>:0
Looks like it was a problem with the mono framework.
The server was running on 2.10.5 Mono on a 12.04 LTS server.
I hosted the API on a new 14.04 LST server with Mono 3.2.6 installed.
Works fine now.
Maybe ServiceStack was updated which was not compatible with 2.10.5 anymore. Not sure, can only speculate.

Method not found: 'System.Web.Hosting.HostingEnvironment.get_InClientBuildManager'

I'm running ASP.NET MVC 4 application on Linux machine thanks to Mono, my problem is that each time I run it for few seconds instead of displaying page I get following error:
System.MissingMethodException
Method not found: 'System.Web.Hosting.HostingEnvironment.get_InClientBuildManager'.
Description:
HTTP 500.Error processing request.
Details:
Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Version Information(server is xsp):
3.2.8 (Debian 3.2.8+dfsg-4ubuntu1); ASP.NET Version: 4.0.30319.17020
Detailed info:
[System.Web.HttpException]: The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation. at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x00000] in :0 at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00000] in :0 [System.Reflection.TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x00000] in :0 [System.MissingMethodException]: Method not found: 'System.Web.Hosting.HostingEnvironment.get_InClientBuildManager'. at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
As I said, this error is gone shortly after starting application but I'm looking for solution to it. I don't have similiar error on other machine.
Version information(Debian+Nginx+FastCGI):
3.6.1 (master/1910095 Mon Jul 7 12:30:38 CEST 2014); ASP.NET Version: 4.0.30319.17020

Categories

Resources