* Fixes mantis mantis 0006803 [PGSQL] - Simulator crashes - Mono.Security.dll missing. The root of the issue is that the Postgres driver relies on Mono.Security.dll from the mono project. Unfortunately, when using Mono, including the dll in the distribution causes conflicts. This solution puts Mono.Security.dll in bin/lib/NET/ and, if windows .NET is the runtime, informs the assembly loader to load bin/lib/NET/Mono.Security.dll when .NET is scanning for the Mono.Security namespace. On Mono, the included Mono.Security assembly is ignored.
parent
766a31431e
commit
8fdf70b87e
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
@ -50,8 +51,30 @@ namespace OpenSim.Data.PGSQL
|
||||||
protected PGSqlFramework(string connectionString)
|
protected PGSqlFramework(string connectionString)
|
||||||
{
|
{
|
||||||
m_connectionString = connectionString;
|
m_connectionString = connectionString;
|
||||||
|
InitializeMonoSecurity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InitializeMonoSecurity()
|
||||||
|
{
|
||||||
|
if (!Util.IsPlatformMono)
|
||||||
|
{
|
||||||
|
AppDomain currentDomain = AppDomain.CurrentDomain;
|
||||||
|
currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveEventHandlerMonoSec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private System.Reflection.Assembly ResolveEventHandlerMonoSec(object sender, ResolveEventArgs args)
|
||||||
|
{
|
||||||
|
Assembly MyAssembly = null;
|
||||||
|
|
||||||
|
if (args.Name.Substring(0, args.Name.IndexOf(",")) == "Mono.Security")
|
||||||
|
{
|
||||||
|
MyAssembly = Assembly.LoadFrom("lib/NET/Mono.Security.dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return the loaded assembly.
|
||||||
|
return MyAssembly;
|
||||||
|
}
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// All non queries are funneled through one connection
|
// All non queries are funneled through one connection
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using OpenSim.Framework;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
@ -56,6 +57,29 @@ namespace OpenSim.Data.PGSQL
|
||||||
public PGSQLManager(string connection)
|
public PGSQLManager(string connection)
|
||||||
{
|
{
|
||||||
connectionString = connection;
|
connectionString = connection;
|
||||||
|
InitializeMonoSecurity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeMonoSecurity()
|
||||||
|
{
|
||||||
|
if (!Util.IsPlatformMono)
|
||||||
|
{
|
||||||
|
AppDomain currentDomain = AppDomain.CurrentDomain;
|
||||||
|
currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveEventHandlerMonoSec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private System.Reflection.Assembly ResolveEventHandlerMonoSec(object sender, ResolveEventArgs args)
|
||||||
|
{
|
||||||
|
Assembly MyAssembly = null;
|
||||||
|
|
||||||
|
if (args.Name.Substring(0, args.Name.IndexOf(",")) == "Mono.Security")
|
||||||
|
{
|
||||||
|
MyAssembly = Assembly.LoadFrom("lib/NET/Mono.Security.dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return the loaded assembly.
|
||||||
|
return MyAssembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue