ServiceStackHost.Instance has already been set - c#

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.

Related

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.

C# MonoDevelop: Invalid -langversion CS1617

I just installed MonoDevelop 5.0.1 in Ubuntu 12.04 and tried to compile a simple Hello World.
This results in the following build error:
Error CS1617: Invalid -langversion option `Version5'. It must be `ISO-1', `ISO-2', `3', `4', `5', `Default' or `Future' (CS1617)
I looked through the options and everything I found seems to be set up correctly. Edit>Preferences>Projects>.NET Runtimes has Mono 3.2.1 included.
The only section I cannot access is Project>Project Options>Build>General, which causes an Exception to be thrown:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Unknown LangVersion string ''
at MonoDevelop.CSharp.Project.CSharpCompilerParameters.get_LangVersion () [0x00000] in <filename unknown>:0
at MonoDevelop.CSharp.Project.CompilerOptionsPanelWidget..ctor (MonoDevelop.Projects.DotNetProject project) [0x00000] in <filename unknown>:0
at MonoDevelop.CSharp.Project.CompilerOptionsPanel.CreatePanelWidget () [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.CreatePageWidget (MonoDevelop.Ide.Gui.Dialogs.SectionPage page) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.ShowPage (MonoDevelop.Ide.Extensions.OptionsDialogSection section) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.OnSelectionChanged (System.Object s, System.EventArgs a) [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
--- End of inner exception stack trace ---
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
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0
The same error already occurred in MonoDevelop 2.something from the Ubuntu package manager.
I can't help you with the solution may be, but I can give you why this is happening -
Please visit this links -
The reason http://msdn.microsoft.com/en-us/library/ydy7a2we(v=vs.90).aspx
Mono Develop System Requirements.
http://monodevelop.com/developers/building_monodevelop
Make sure that MonoDeveloper supports the Mono version you are using.
I (think I) found the issue and now it appears to be working correctly. Apparently, one of the project files was corrupted for some reason. Deleting the old project and creating a new one helped.

System.Collections.Generic.KeyNotFoundException with Mono, but not Microsoft's .NET

I found a really strange problem while creating unit tests that only occurs with the Mono runtime (Xamarin on Mac included), but runs fine within Visual Studio. I isolated it as far as I could, and I reached a point that I can't tell if it is a bug with Mono, Moq or Castle DinamicProxy, although it only crashes when using the Mono runtime.
This is the code:
using System;
using System.Collections.Generic;
using Moq;
namespace ConsoleApplication1
{
public interface ISomething<T>
{
List<T> DoSomething<U>(/*Func<T, U> expression*/);
}
public class Foo { }
public class Program
{
public static void Main(string[] args) {
var mock = new Mock<ISomething<Foo>>();
Console.WriteLine(mock.Object);
}
}
}
Here's that I know:
It compiles and run with within Visual Studio 2012. The output is "Castle.Proxies.ISomething`1Proxy"
It does not work when running with the Mono runtime. An exception is thrown (see below)
If I change the declaration from an interface to an abstract class, it works with Mono
If I change the return type from List<T> to anything else, it works with Mono
If I remove the generic type <U>, it works with mono
Got the same results under Windows, Mac and Linux using the command line build from http://mono-project.com
In Windows it fails with Mono 2.10.9, but works within Xamarin.Studio (4.0.10)
In Mac, it fails within Xamarin.Studio (4.0.10)
I recompiled Moq linking agains the latest DynamicProxy release (Castle.Core.3.2.0), with no changed to the behaviour.
Although I've found this problem when using Moq, but I can't tell if it's related to it or even DynamicProxy. The partial exception is below, complete can be found at http://pastie.org/8203093
mono ConsoleApplication1.exe
[ERROR] FATAL UNHANDLED EXCEPTION: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[System.String,System.Reflection.Emit.GenericTypeParameterBuilder].get_Item (System.String key) [0x00000] in <filename unknown>:0
at Castle.DynamicProxy.Internal.TypeUtil.CloseGenericParametersIfAny (Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter emitter, System.Type[] arguments) [0x00000] in <filename unknown>:0
at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget (System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.IInterceptor[] interceptors) [0x00000] in <filename unknown>:0
at Moq.Proxy.CastleProxyFactory.CreateProxy[ISomething`1] (ICallInterceptor interceptor, System.Type[] interfaces, System.Object[] arguments) [0x00000] in <filename unknown>:0
[....]
at Moq.Mock`1[ConsoleApplication1.ISomething`1[ConsoleApplication1.Foo]].<InitializeInstance>b__0 () [0x00000] in <filename unknown>:0
at Moq.PexProtector.Invoke (System.Action action) [0x00000] in <filename unknown>:0
at Moq.Mock`1[ConsoleApplication1.ISomething`1[ConsoleApplication1.Foo]].InitializeInstance () [0x00000] in <filename unknown>:0
at Moq.Mock`1[ConsoleApplication1.ISomething`1[ConsoleApplication1.Foo]].OnGetObject () [0x00000] in <filename unknown>:0
at Moq.Mock.GetObject () [0x00000] in <filename unknown>:0
at Moq.Mock.get_Object () [0x00000] in <filename unknown>:0
at Moq.Mock`1[ConsoleApplication1.ISomething`1[ConsoleApplication1.Foo]].get_Object () [0x00000] in <filename unknown>:0
at ConsoleApplication1.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

Mono TypeLoadException in ChannelFactory<>.CreateChannel, no exception on .NET/Windows

I am creating a net.tcp based WCF service to control one of our backend applications. During development and testing on a Windows machine everything worked as expected.
However when I tried to run the very same application using Mono on either the same Windows box (Mono 2.10.6) or on Debian Squeeze (with Mono 2.10.5), I suddenly get a TypeLoadException in the ChannelFactory.
In the end it comes down to just this call that fails:
controlHost = ChannelFactory<IControlServiceContract>.CreateChannel(
new NetTcpBinding(SecurityMode.None),
new EndpointAddress(endpointAddress)
);
With this definition for IControlServiceContract in another assembly:
[ServiceContract]
public interface IControlServiceContract
{
[OperationContract(IsOneWay = true)]
void Ping ();
[OperationContract(IsOneWay = true)]
void Shutdown ();
[OperationContract]
int GetCommandCount ();
}
Which runs fine when started directly (i.e. using .NET).
When executed using mono --debug --runtime=v4.0 though it crashes with this super sweet stack trace:
! Ein Fehler ist beim Erzeugen des Kanals auf net.tcp://localhost:34684/watchdog/watchdog.ctrl/ aufgetreten
A type load exception has occurred.
at System.Linq.Enumerable.Union[Object] (IEnumerable`1 first, IEnumerable`1 second, IEqualityComparer`1 comparer) [0x00014] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.Core\System.Linq\Enumerable.cs:2948
at System.Linq.Enumerable.Union[Object] (IEnumerable`1 first, IEnumerable`1 second) [0x00007] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.Core\System.Linq\Enumerable.cs:2938
at System.ServiceModel.Description.ContractDescriptionGenerator.GetOrCreateOperation (System.ServiceModel.Description.ContractDescription cd, System.Reflection.MethodInfo mi, System.Reflection.MethodInfo serviceMethod, System.ServiceModel.OperationContractAttribute oca, System.Type asyncReturnType, Boolean isCallback, System.Type givenServiceType) [0x001f2] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:314
at System.ServiceModel.Description.ContractDescriptionGenerator.FillOperationsForInterface (System.ServiceModel.Description.ContractDescription cd, System.Type exactContractType, System.Type givenServiceType, Boolean isCallback) [0x00131] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:240
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContractInternal (System.Type givenContractType, System.Type givenServiceType, System.TypeserviceTypeForCallback) [0x00296] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:197
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:136
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:131
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type contractType) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:101
at System.ServiceModel.Description.ContractDescription.GetContract (System.Type contractType) [0x00017] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescription.cs:66
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract].CreateDescription () [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel\ChannelFactory_1.cs:185
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract]..ctor (System.Type type) [0x00033] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel\ChannelFactory_1.cs:56
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract]..ctor (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract].CreateChannel (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel\ChannelFactory_1.cs:130
at applicationframework.ControlApplicationBase.ConnectionCreate (IControlServiceContract& controlHost, System.String endpointHost, Int32 endpointPort, System.String endpointPath) [0x00000] in <filename unknown>:0
All assemblies used int his project are either our own ones targeted at Framework 4.0, core assemblies and log4net 1.2.10/2.0.50727.
Does anyone have a clue what this could be and where I should start digging?
Well, if it works on .NET and not Mono it's definitely a bug.
I would go ahead and first thing submit it in http://bugzilla.xamarin.com/
Then maybe hangout in irc://irc.gnome.org/mono , and poke Atsushi Enomoto (nick "eno") which is the maintainer of WCF, to see what he thinks.

Categories

Resources