there
Runtime Context: I write a simple WCF console application by VS2012,running smoothly on Windows, but exception happened when try to run it on Ubuntu by mono
Mono Version: 2.10.6
Exception:
Unhandled Exception: System.InvalidOperationException: None of the listener channel types is supported
at System.ServiceModel.ServiceHostBase.BuildListener (System.ServiceModel.Description.ServiceEndpoint se, System.ServiceModel.Channels.BindingParameterCollection pl) [0x00000] in :0
at System.ServiceModel.ServiceHostBase.BuildChannelDispatcher (System.ServiceModel.Description.ServiceEndpoint se, System.ServiceModel.Channels.BindingParameterCollection commonParams) [0x00000] in :0
at System.ServiceModel.ServiceHostBase.InitializeRuntime () [0x00000] in :0
at System.ServiceModel.ServiceHostBase.OnOpen (TimeSpan timeout) [0x00000] in :0
at System.ServiceModel.Channels.CommunicationObject.Open (TimeSpan timeout) [0x00000] in :0
at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in :0
at DynIPServiceHost.Program.Main (System.String[] args) [0x00000] in :0
The Only Main function is :
static void Main(string[] args)
{
try
{
Binding binding = new NetTcpBinding();
ServiceHost sh = new ServiceHost(typeof(DynIPService.DynIPService));
sh.AddServiceEndpoint("DynIPServiceContract.IDynIPService", binding, "net.tcp://10.161.66.213:808");
sh.Open();
foreach (var ep in sh.Description.Endpoints)
{
Console.WriteLine("Address: {0}, ListenUri: {1}, ListenUriMode: {2} ", ep.Address, ep.ListenUri, ep.ListenUriMode);
}
Console.WriteLine("Service is running");
//Console.WriteLine("Current Uri is:);
}
catch (Exception ex)
{
Console.WriteLine("Error:" + ex.Message);
throw;
}
finally
{
Console.ReadKey();
}
}
}
Related
I am getting below exception
Unhandled exception. System.AggregateException: One or more hosted services failed to stop. (The operation was canceled.)
---> System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at Hangfire.Processing.TaskExtensions.WaitOneAsync(WaitHandle waitHandle, TimeSpan timeout, CancellationToken token)
at Hangfire.Processing.BackgroundDispatcher.WaitAsync(TimeSpan timeout, CancellationToken cancellationToken)
at Hangfire.Server.BackgroundProcessingServer.WaitForShutdownAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StopAsync(CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.Extensions.Hosting.Internal.Host.StopAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.WaitForShutdownAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Microsoft.AspNetCore.Builder.WebApplication.Run(String url
Asp.net core version 6.0.3
Hangfire.core Version 1.7.28 Hangfire.Aspnetcore version 1.7.28
I have asp.net core application with Hangfire integrated with it
sudo code:
startup.cs
ConfigureServices method
services.AddHangfire();
services.AddHangfireServer();
Configure method
app.UseHangfireDashboard("/hangfire");
Research and analysis till now,
As exception is thrown Microsoft.Extensions.Hosting.Internal.Host.StopAsync I understand that hangfire a hosted service internally and that causes an issue.
possible solution could be if the above service is my custom hosted service i could have wrapped it
under a IHostedService service and could have handled the exception as below eg
public class MyHostedServiceWrapper : IHostedService
{
private readonly ILogger<MyHostedServiceWrapper> _logger;
private readonly IHostedService _innerService;
public MyHostedServiceWrapper(ILogger<MyHostedServiceWrapper> logger, IHostedService innerService)
{
_logger = logger;
_innerService = innerService;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
try
{
await _innerService.StartAsync(cancellationToken);
}
catch (Exception ex)
{
_logger.LogError(ex, "An error occurred while starting the hosted service");
}
}
public async Task StopAsync(CancellationToken cancellationToken)
{
try
{
await _innerService.StopAsync(cancellationToken);
}
catch (Exception ex)
{
_logger.LogError(ex, "An error occurred while stopping the hosted service");
}
// Return a completed task to indicate that the service has stopped
await Task.CompletedTask;
}
}
But that is not the case.
I just want to skip the above exception without crashing the application
I wanted to peform a background task using https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.ihostedservice?view=aspnetcore-2.1 in .net core 2.1 and needs to host in PCF. When I run locally everything works fine. My implementation of IHostedService is getting called after Startup activites and I am able to terminate the application gracefully via https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.iapplicationlifetime.stopapplication?view=aspnetcore-2.1. But when I host in PCF, I am getting below error
2018-11-09T18:27:35.359+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [OUT] Finished executing task!
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] Unhandled Exception: System.Net.Sockets.SocketException: Permission denied
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at System.Net.Sockets.Socket.Bind(EndPoint localEP)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass22_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] --- End of stack trace from previous location where exception was thrown ---
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Core.AnyIPListenOptions.BindAsync(AddressBindContext context)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func`2 createBinding)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at DlqProcessingApp.Program.Main(String[] args) in C:\GitRepos\DeadLetterQueueProcessingTask\Program.cs:line 72
2018-11-09T18:27:35.365+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [ERR] at DlqProcessingApp.Program.<Main>(String[] args)
2018-11-09T18:27:35.381+05:30 [APP/TASK/execute-dlqprcoessing-task/0] [OUT] Exit status 134
I am registering IHostedService like below in my Startup.cs
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add management endpoint services
services.AddCloudFoundryActuators(Configuration);
services.AddSingleton<IHostedService, DlqProcessingHostedService>();
My implementation looks like below
public class DlqProcessingHostedService : IHostedService
{
private readonly IApplicationLifetime _appLifetime;
private readonly ILogger<DlqProcessingHostedService> _logger;
private readonly IServiceScopeFactory _serviceScopeFactory;
public DlqProcessingHostedService(IApplicationLifetime appLifetime,
IServiceScopeFactory serviceScopeFactory,
ILogger<DlqProcessingHostedService> logger)
{
_appLifetime = appLifetime;
_logger = logger;
_serviceScopeFactory = serviceScopeFactory;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
using (var scope = _serviceScopeFactory.CreateScope())
{
var he = scope.ServiceProvider.GetRequiredService<HealthEndpoint>();
var worker = scope.ServiceProvider.GetRequiredService<IWorker>();
CheckStartupHealth(he);
await worker.ProcessDlxMessages();
}
_appLifetime.StopApplication();
}
public async Task StopAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("Finished executing task!");
}
Btw, if i am using generic host https://jmezach.github.io/2017/10/29/having-fun-with-the-.net-core-generic-host/ instead of WebHost, this is working fine. So basically I would like to know whether an IHostedService implementation is having any issue with WebHost in PCF environment(It is working fine locally though). I am using the below packages and targeting a cflinuxfs2 stack. Please let me know what I might be doing wrong.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
<PackageReference Include="Steeltoe.Extensions.Configuration.CloudFoundryCore" Version="2.1.1" />
<PackageReference Include="RabbitMQ.Client" Version="5.1.0" />
<PackageReference Include="Steeltoe.CloudFoundry.ConnectorCore" Version="2.1.1" />
<PackageReference Include="Steeltoe.Management.CloudFoundryCore" Version="2.1.1" />
</ItemGroup>
Here is my Program.cs
public class Program
{
public static async Task Main(string[] args)
{
//var host = new HostBuilder()
//.ConfigureAppConfiguration((hostContext, config) =>
//{
// var env = hostContext.HostingEnvironment;
// config.SetBasePath(Directory.GetCurrentDirectory());
// config.AddEnvironmentVariables();
// config.AddCommandLine(args);
// config.AddJsonFile("appsettings.json", true, false);
// config.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, false);
// config.AddCloudFoundry();
//})
//.ConfigureServices((hostContext, services) =>
//{
// ConfigureServices(services, hostContext.Configuration);
//})
//.ConfigureLogging((hostContext, logBuilder) =>
//{
// logBuilder.ClearProviders();
// logBuilder.AddConfiguration(hostContext.Configuration.GetSection("Logging"));
// logBuilder.AddDynamicConsole();
// if (hostContext.HostingEnvironment.IsDevelopment())
// {
// logBuilder.AddDebug();
// }
//});
//await host.RunConsoleAsync();
BuildWebHost(args).Run();
Console.WriteLine("Finished executing task!");
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddCloudFoundry();
})
.ConfigureLogging((hostContext, logBuilder) =>
{
logBuilder.ClearProviders();
logBuilder.AddConfiguration(hostContext.Configuration.GetSection("Logging"));
logBuilder.AddDynamicConsole();
if (hostContext.HostingEnvironment.IsDevelopment())
{
logBuilder.AddDebug();
}
}).Build();
I tried to recreate this with a basic sample based on what you've provided so far, but this works fine on PCF for me - the error is likely coming from somewhere else in your code
I have created NUnit suite that initialises Chrome Webdriver in Selenium. This works fine with InternetExplorer driver and Firefox driver however fails with SerializationException every time I try to run it with Chrome driver.
Anyone can point me in right direction?
namespace TestNamespace
{
using System;
using NUnit.Framework;
using NUnit.Core;
using SeleniumTests;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
class AllInOne
{
public static IWebDriver WebDriver { get; private set; }
[Suite]
public static TestSuite Suite
{
get
{
TestSuite suite = new TestSuite("All Tests");
SetupChrome();
suite.Add(new FlashLoadedTest { Driver = WebDriver });
return suite;
}
}
private static void SetupChrome()
{
WebDriver = new ChromeDriver(#"C:\Users\<username>\AppData\Local\Google\Chrome\Application");
}
}
}
This is error I get:
Unhandled Exception:
System.Runtime.Serialization.SerializationException: Unable to find assembly 'WebDriver, Version=2.15.0.0, Culture=neutral, PublicKeyToken=1c2bd1631853048f'.
Server stack trace:
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create(String name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeMessageParts(MemoryStream stm)
at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage.FixupForNewAppDomain()
at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(IMessage reqMsg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
I am not into NUnit, but I believe that IWebDriver class is for Internet Explorer only - but that applies to Java
Do you have class WebDriver also? If yes, try using it.
I'm doing unit test(using NUnit) on Postgresql, unfortunately it causes an error:
Internal error
RemotingException: Unix transport error.
Note: The error doesn't happen if I'm using Sqlite
Code:
using System;
using ncfg = NHibernate.Cfg;
using System.Collections.Generic;
using System.Reflection;
using NHibernate;
using System.Data;
using NHibernate.Tool.hbm2ddl;
using NHibernate.Dialect;
using NHibernate.Driver;
using NHibernate.ByteCode.LinFu;
using NUnit.Framework;
using NHibernate.Mapping;
namespace RuntimeNhibernate
{
class MainClass
{
public static void Main (string[] args)
{
using(var c = new BlogTestFixture())
{
c.CanSaveAndLoadBlog();
}
}
}
public class InMemoryDatabaseTest : IDisposable
{
private static ncfg.Configuration Configuration;
private static ISessionFactory SessionFactory;
protected ISession session;
public InMemoryDatabaseTest(Assembly assemblyContainingMapping)
{
if (Configuration == null)
{
Configuration = new ncfg.Configuration()
.SetProperty(ncfg.Environment.ReleaseConnections,"on_close")
.SetProperty(ncfg.Environment.Dialect, typeof (SQLiteDialect).AssemblyQualifiedName)
.SetProperty(ncfg.Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName)
.SetProperty(ncfg.Environment.ConnectionString, "data source=:memory:")
.SetProperty(ncfg.Environment.ProxyFactoryFactoryClass, typeof (ProxyFactoryFactory).AssemblyQualifiedName)
.AddAssembly(assemblyContainingMapping);
/*Configuration = new ncfg.Configuration()
.SetProperty(ncfg.Environment.ReleaseConnections,"on_close")
.SetProperty(ncfg.Environment.Dialect, typeof (PostgreSQLDialect).AssemblyQualifiedName)
.SetProperty(ncfg.Environment.ConnectionDriver, typeof(NpgsqlDriver).AssemblyQualifiedName)
.SetProperty(ncfg.Environment.ConnectionString, "Server=127.0.0.1;Database=memdb;User ID=postgres;Password=password;Pooling=false;")
.SetProperty(ncfg.Environment.ProxyFactoryFactoryClass, typeof (ProxyFactoryFactory).AssemblyQualifiedName)
.AddAssembly(assemblyContainingMapping);*/
SessionFactory = Configuration.BuildSessionFactory();
}
session = SessionFactory.OpenSession();
new SchemaExport(Configuration).Execute(true, true, false, session.Connection, Console.Out);
}
public void Dispose()
{
session.Dispose();
}
}//class InMemory
public class Blog
{
public virtual int BlogId { get; set; }
public virtual bool AllowsComments { set; get; }
public virtual DateTime CreatedAt { get; set; }
public virtual string Subtitle { get; set; }
public virtual string Title { get; set; }
}
[TestFixture]
public class BlogTestFixture : InMemoryDatabaseTest
{
public BlogTestFixture() : base(typeof(Blog).Assembly)
{
}
[Test]
public void IsOK()
{
Assert.AreEqual(true, true);
return;
}
[Test]
public void CanSaveAndLoadBlog()
{
object id;
using (var tx = session.BeginTransaction())
{
id = session.Save(new Blog
{
AllowsComments = true,
CreatedAt = new DateTime(2000,1,1),
Subtitle = "Hello",
Title = "World",
});
tx.Commit();
}
session.Clear();
Console.WriteLine("Hello {0}", id);
using (var tx = session.BeginTransaction())
{
var blog = session.Get<Blog>(id);
Assert.AreEqual(new DateTime(2000, 1, 1), blog.CreatedAt);
Assert.AreEqual("Hello", blog.Subtitle);
Assert.AreEqual("World", blog.Title);
Assert.AreEqual(true, blog.AllowsComments);
tx.Commit();
}
}
}//Test
}//namespace
What could be the possible reason when I unit test Postgresql, it results to RemotingException: Unix transport error. ?
If I run the code outside of unit test (e.g. Main), it works. Btw, if I unit test Sqlite, it doesn't cause any errors too
Found the answer, I tried launching MonoDevelop from Terminal (/Applications/MonoDevelop.app/Contents/MacOS/monodevelop), I saw the more detailed error from the commandline when I ran the unit tests.
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Npgsql.NpgsqlConnection ---> System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'Npgsql'.
at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType) [0x00000] in <filename unknown>:0
at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0
at System.Reflection.Assembly.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0
at System.Resources.ResourceManager.GetNeutralResourcesLanguage (System.Reflection.Assembly a) [0x00000] in <filename unknown>:0
at System.Resources.ResourceManager..ctor (System.Type resourceSource) [0x00000] in <filename unknown>:0
at Npgsql.NpgsqlConnection..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod*,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Then I tried changing the Npgsql version(the one that causes an error came from http://pgfoundry.org/frs/download.php/2868/Npgsql2.0.11-bin-ms.net4.0.zip) to http://pgfoundry.org/frs/download.php/2860/Npgsql2.0.11-bin-mono2.0.zip After this, there's no more Unix transport error ^_^
Lesson learned, use the Mono version of the component you are using if you are running things on Mono
This exception occurs, when a unit test in MonoDevelop raises an exception, which could not be caught by the test runner (i.e. when the test starts some threads and they crash).
If you have such a test which is grey even after running
and the unit test pad shows the internal error
you should try running the test on your console with nunit-console (should be in the repo of your distro where mono comes from) and leak the exception.
In my case it was a simple multiple enumeration exception in a sub-thread of my test.
Unhandled exceptions:
1) Residata.Platform.Server.Message.Test.MemoryBrokerTest.AssertThatReceiveMethodWaitsUntilPublish : System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1+Enumerator[Residata.Platform.Contract.Message.IPackage].MoveNext () [0x00000] in <filename unknown>:0
I am quite blocked about an exception.
I am using Active Record and Monorail. I was able to use the scaffold controllers in monorail, until I add new models.
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[System.String,NHibernate.Mapping.PersistentClass].get_Item (System.String key) [0x00000]
at NHibernate.Cfg.Configuration+Mapping.GetPersistentClass (System.String className) [0x00000]
at NHibernate.Cfg.Configuration+Mapping.GetIdentifierType (System.String className) [0x00000]
at NHibernate.Type.EntityType.GetIdentifierType (IMapping factory) [0x00000]
at NHibernate.Type.EntityType.GetIdentifierOrUniqueKeyType (IMapping factory) [0x00000]
at NHibernate.Persister.Entity.AbstractPropertyMapping.InitIdentifierPropertyPaths (System.String path, NHibernate.Type.EntityType etype, System.String[] columns, IMapping factory) [0x00000]
at NHibernate.Persister.Entity.AbstractPropertyMapping.InitPropertyPaths (System.String path, IType type, System.String[] columns, System.String[] formulaTemplates, IMapping factory) [0x00000]
at NHibernate.Persister.Entity.AbstractEntityPersister.InitOrdinaryPropertyPaths (IMapping mapping) [0x00000]
at NHibernate.Persister.Entity.AbstractEntityPersister.InitPropertyPaths (IMapping mapping) [0x00000]
at NHibernate.Persister.Entity.AbstractEntityPersister.PostConstruct (IMapping mapping) [0x00000]
at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor (NHibernate.Mapping.PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping) [0x00000]
at NHibernate.Persister.PersisterFactory.CreateClassPersister (NHibernate.Mapping.PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg) [0x00000]
at NHibernate.Impl.SessionFactoryImpl..ctor (NHibernate.Cfg.Configuration cfg, IMapping mapping, NHibernate.Cfg.Settings settings, NHibernate.Event.EventListeners listeners) [0x00000]
at NHibernate.Cfg.Configuration.BuildSessionFactory () [0x00000]
at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory (System.Type type) [0x00000]
at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateScopeSession (System.Type type) [0x00000]
at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession (System.Type type) [0x00000]
at (wrapper synchronized) Castle.ActiveRecord.Framework.SessionFactoryHolder:CreateSession (System.Type)
at Castle.ActiveRecord.ActiveRecordBase.FindAll (System.Type targetType, NHibernate.Criterion.DetachedCriteria detachedCriteria, NHibernate.Criterion.Order[] orders) [0x00000]
at Castle.ActiveRecord.ActiveRecordBase.FindAll (System.Type targetType) [0x00000]
at Inventory.Product.FindAll () [0x00000] in /home/mariocesar/Proyectos/Mangos/Mangos.Apps/Inventory/Product.cs:114
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (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]
Here is all the sourcecode: http://bitbucket.org/mariocesar/mangos/src
By Example, for the model Inventory.Product there is the ProductsController, it Work until I add some relations.
http://bitbucket.org/mariocesar/mangos/src/tip/Mangos.Apps/Inventory/Product.cs
I don't understand if the problem is in NHibernate, or if can't be Scaffold, or if the problem is ActivRecord.
A hint, would be nice
I found the problem, was a Missing Active Record declaration.
http://bitbucket.org/mariocesar/mangos/changeset/6e81c9f81d47