Xamarin Form Encoding issue [duplicate] - c#

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'

Related

OleDB in Pythonnet and Mono on Mac OS X

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

SQL Server connection with Unity

I'm trying to connect my Unity project to SQL Server. I have connected my Windows Forms application in Visual Studio 2017 successfully. And I think if copy the exact code in a unity script my goal should happen. I have imported System.Data.Dll V3.5 to my assets and using unity2018.2.1.f1. I am using the following script trying to first open the connection but I get the error below.
void Start ()
{
try
{
string ConnString = "Data Source=DESKTOP-PVB5MHG;Initial Catalog=UnityTest;User ID=legend;Password=legend";
SqlConnection MyConn = new SqlConnection(ConnString);
MyConn.Open();
Debug.Log("Connection opened !");
}
catch(System.Exception ex)
{
Debug.Log(ex.ToString());
}
}
System.Data.SqlClient.SqlException: Server does not exist or
connection refused.
Mono.Data.Tds.Protocol.TdsInternalException: Server does not exist or connection refused.
System.Net.Sockets.SocketException: An address incompatible with the requested protocol was used.
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP,
Boolean requireSocketPolicy) [0x00000] in :0
at System.Net.Sockets.Socket+Worker.Connect () [0x00000] in :0
--- End of inner exception stack trace ---
at Mono.Data.Tds.Protocol.TdsComm..ctor (System.String dataSource, Int32
port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion) [0x00000] in :0
at Mono.Data.Tds.Protocol.Tds..ctor (System.String dataSource, Int32
port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion) [0x00000] in :0
at Mono.Data.Tds.Protocol.Tds70..ctor (System.String server, Int32 port,
Int32 packetSize, Int32 timeout, TdsVersion version) [0x00000] in
:0 at Mono.Data.Tds.Protocol.Tds80..ctor
(System.String server, Int32 port, Int32 packetSize, Int32 timeout)
[0x00000] in :0 at
Mono.Data.Tds.Protocol.TdsConnectionPoolManager.CreateConnection
(Mono.Data.Tds.Protocol.TdsConnectionInfo info) [0x00000] in :0 at
Mono.Data.Tds.Protocol.TdsConnectionPool.GetConnection () [0x00000] in
:0 at System.Data.SqlClient.SqlConnection.Open ()
[0x00000] in :0 --- End of inner exception stack
trace --- at System.Data.SqlClient.SqlConnection.Open () [0x00000]
in :0 at DB.Start () [0x00010] in
D:\UnityProjects2018\DataBaseTest1\Assets\DB.cs:15
UnityEngine.Debug:Log(Object) DB:Start() (at Assets/DB.cs:20)
You cannot use ODBC in Unity due to limitations in Mono. Use http://github.com/dotnet/SqlClient instead.
Your specific error is related to the differences in how machine names are resolved in Mono versus the ancient version of .Net framework of the WinForms era. DESKTOP-PVB5MHG will not be a valid DNS name, while Mono only uses DNS to resolve Data Source.

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,

Xamarin.IOS MvvmCross App throws NullReference Exception in ViewDidLoad method in iOS9

I am working on an existing Xamarin iOS application with a PCL and uses MvvmCross for IoC and Databinding. Built on MvvmCross 3.1.1
The App looks like a TabControl App but it is buttons on the MainViewCotnroller giving the Tab feel to it. Views are declared in the Storyboard and in the MainViewController,
PrepareForSegue(UIStoryboardSegue segue, NSObject sender) method
is overridden to load the selected "Tab" View based on the Segue selected - like below
if (segue.Identifier == "FirstSegue")
{
var dest = segue.DestinationViewController as FirstView;
dest.Request = new MvxViewModelRequest<FirstViewModel>(null, null, new MvxRequestedBy());
foreach (UIView v in src.placeHolderView.Subviews)
{
v.RemoveFromSuperview();
}
dest.View.Frame = new CGRect(0f, 0f, w, h);
src.placeHolderView.Add(dest.View);
}
The App runs fine on iPhones with iOS 7.1 till 8.4.
Just before iOS 9 was released I did a test installation for the App on iPhone 6 with iOS 9.1 beta and the App crashed on loading. I retrieved the device logs (below) and analysed that the problem is in the guts of the MvvmCross ViewDidLoad method. I updated the latest SDKs (XCode 7, Xamarin.IOS 9.0) and followed instructions provided by Xamarin and compiled the App again using the latest SDKs same error. Updated the Nuget package reference for MvvmCross to 3.5.1 and still the same issue
The issues is there is a null reference at Line 44 in the 3.5 MvvMCross Source Code in GitHub
Note: This piece of code has not changed since 3.1 at least and 3.5.1 is the latest in the nuget for MvvmCross
Stack Trace below (App Names, Project Names changed for security reasons):
2015-09-21 11:06:26.991 MyApp[1210:60b] Unhandled managed exception:
Object reference not set to an instance of an object (System.NullReferenceException)
at Cirrious.CrossCore.Mvx.Resolve[IMvxViewModelLoader] () [0x00006] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxViewControllerExtensionMethods.LoadViewModel (IMvxTouchView touchView) [0x00057] in <filename unknown>:0
at Cirrious.MvvmCross.Views.MvxViewExtensionMethods.OnViewCreate (IMvxView view, System.Func`1 viewModelLoader) [0x00012] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxViewControllerExtensionMethods.OnViewCreate (IMvxTouchView touchView) [0x00001] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxViewControllerAdapter.HandleViewDidLoadCalled (System.Object sender, System.EventArgs e) [0x00007] in <filename unknown>:0
at (wrapper delegate-invoke) <Module>:invoke_void_object_EventArgs (object,System.EventArgs)
at Cirrious.CrossCore.Core.MvxDelegateExtensionMethods.Raise (System.EventH
andler eventHandler, System.Object sender) [0x00004] in <filename unknown>:0
at Cirrious.CrossCore.Touch.Views.MvxEventSourceTableViewController.ViewDidLoad () [0x00006] in <filename unknown>:0
at MyProject.Touch.MostPurchasedView.ViewDidLoad () [0x00048] in d:\Working\Repo\MyApp\<MyProjectName>\MyProject.Touch\Views\OneOfTheView.cs:31
at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at UIKit.UIViewController.get_View () [0x00030] in /Users/builder/data/lanes/2077/d230615b/source/maccore/src/build/ios/native/UIKit/UIViewController.g.cs:2632
at MyProject.Touch.HomeViewController.PrepareForSegue (UIKit.UIStoryboardSegue segue, Foundation.NSObject sender) [0x0016a] in d:\Working\Repo\MyApp\MyProject.Mobile\MyProject.Touch\HomeViewController.cs:335
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at
UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2077/d230615b/source/maccore/src/UIKit/UIApplication.cs:74
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/builder/data/lanes/2077/d230615b/source/maccore/src/UIKit/UIApplication.cs:57
at MyProject.Touch.Application.Main (System.String[] args) [0x00001] in d:\Working\Repo\MyApp\MyProject.Mobile\MyProject.Touch\Main.cs:16
2015-09-21 11:06:26.994 MyApp[1210:60b] critical: Stacktrace:
Native stacktrace:
.....
I tried the above with just calling the below in the View.cs:
public override void ViewDidLoad()
{
try
{
base.ViewDidLoad();
}
catch (Exception ex)
{
// throw a toast msg in the UI
}
}
I disabled all the base.ViewDidLoad() in all the View.cs files in the ViewDidLoad override methods to take it to the next level and the same problem but inside the constructor of MvxSimpleTableViewSource class
Device Log below:
Object reference not set to an instance of an object (System.NullReferenceException)
at Cirrious.CrossCore.Mvx.TryResolve[IMvxTouchSystem] (IMvxTouchSystem& service) [0x00006] in <filename unknown>:0
at Cirrious.CrossCore.Touch.Platform.MvxIosMajorVersionChecker.ReadIsIosVersionOrHigher (Int32 target, Boolean defaultValue) [0x00000] in <filename unknown>:0
at Cirrious.CrossCore.Touch.Platform.MvxIosMajorVersionChecker..ctor (Int32 major, Boolean defaultValue) [0x00006] in <filename unknown>:0
at Cirrious.MvvmCross.Binding.Touch.Views.MvxSimpleTableViewSource..ctor (UIKit.UITableView tableView, System.String nibName, System.String cellIdentifier, Foundation.NSBundle bundle) [0x00000] in <filename unknown>:0
at MyProject.Touch.MostPurchasedView.ViewDidLoad () [0x00059] in d:\Working\Repo\MyApp\MyProject.Mobile\MyProject.Touch\Views\OneOfTheView.cs:42
at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at UIKit.UIViewController.get_View () [0x00030] in /Users/builder/data/lanes/2077/d230615b/source/maccore/src/build/ios/native/UIKit/UIViewController.g.cs:2632
at MyProject.Touch.HomeViewController.PrepareForSegue (UIKit.UIStoryboardSegue segue, Foundation.NSObject sender) [0x0016a] in d:\Working\Repo\MyApp\MyProject.Mobile\MyProject.Touch\HomeViewController.cs:343
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2077/d230615b/source/maccore/src/UIKit/UIApplication.cs:74
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/builder/data/lanes/2077/d230615b/source/maccore/src/UIKit/UIApplication.cs:57
at MyProject.Touch.Application.Main (System.String[] args) [0x00001] in d:\Working\Repo\MyApp\MyProject.Mobile\MyProject.Touch\Main.cs:16
In short :
Only in iOS 9.1, MvvmCross 3.1.1 AND MvvmCross 3.5.1 has a NullReference Issue in line 44 of the MvxViewControllerExtensionMethods class which gets called during ViewDidLoad but works well with iOS 8.4 and below
I am just getting familiar with MvvmCross framework and unsure whether it is an issue with MvvmCross and iOS 9.
Has anyone come across this issue? Any help on this would be appreciated.
Note: The MvvmCross samples work fine with iOS9. So I believe it has to be something with the Tab implementation.
One thing is that MvvmCross 3.1.1 not is build for iOS unified code. This will prevent you from submitting your app. MvvmCross 4.0 is currently in beta, but i would recommend using it, because it has many fixes.
If the code crashes on line 44 while trying to resolve IMvxViewModelLoader, it probably means that you are missing some package where the IMvxViewModelLoader is.

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.

Categories

Resources