What this error means (JetBrains Rider + Ubuntu Gnome 17.04)? - rider

I created Class Library project, then i see this:
Project 'pldl.DataProvider' load failed
Object reference not set to an instance of an object
--- EXCEPTION #1/1 [NullReferenceException]
Message = “Object reference not set to an instance of an object”
ExceptionPath = Root
ClassName = System.NullReferenceException
HResult = E_POINTER=COR_E_NULLREFERENCE=80004003
Source = JetBrains.Platform.RdFramework
StackTraceString = “at JetBrains.Platform.RdFramework.Tasks.RdEndpoint`2+<>c__DisplayClassa[TReq,TRes].b__7 (JetBrains.Platform.RdFramework.SerializationCtx ctx, JetBrains.Util.Persisten
In solution explorer i see project file "loading failed"

solved by installing mono-devel

Related

Problem with 32-bit COM component from 64-bit application. (TYPE_E_CANTLOADLIBRARY)

I have a created a dummy application for testing purposes which is a 64-bit console application, which creates an instance of a 32-bit COM application. It is a third party application called Laserforms.
static void Main(string[] args)
{
LFM32.Application application;
try
{
application = new LFM32.Application();
Console.WriteLine("Success!");
application.Quit();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
Console.Read();
}
}
Now, this works perfectly on my machine, but when I deploy it to another machine, which has Laserform installed as well I am getting the below error message.
{System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'LFM32.Application'.
This operation failed because the QueryInterface call on the COM component for the interface with IID '{6688DD46-3DA3-4FEC-8A1F-54E1453DCC77}'
failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).}
I have go one through the registry of both and can't see any differences, what else could I be doing wrong?
UPDATE:
So I ran TlbImp on the .tlb file to create a DLL I could reference in my .NET application. This created a couple of extra DLLs and some warnings around Iunknown and some invalid types. I then ran Regasm (from Framework and Framework64) on this and the other DLLs it created but I am still seeing the exact same error.

Sap.Data.SQLAnywhere.SAException: Cannot find the language resource file (dblgen17.dll) when connecting to Sybase SQL Anywhere using .NET

I am trying to establish a connection to a Sybase database, using Sap.Data.SQLAnywhere. Using an SQL Anywhere client works perfect from a workstation, but I am having some trouble running the code within an Azure Function.
This is the beginning of my simple code:
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using System.Data.SqlClient;
using Microsoft.Extensions.Logging;
using System;
using Sap.Data.SQLAnywhere;
namespace SBCTest
{
public static class SybaseTest
{
static string DB_CS_SOURCE = "Host=myIP;UID=myUID;PWD=myPWD;Data Source=myDb;"; static int bulkSize = 5000;
[FunctionName("SybaseTest")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, ILogger log)
{
try
{
var dbSourceCon = new SAConnection()
dbSourceCon.ConnectionString = DB_CS_SOURCE;
dbSourceCon.Open();
//etc... etc...
The problem I am facing, which I can't seem to manage is the following error I get when running the app:
[Error] System.TypeInitializationException: The type initializer for 'Sap.Data.SQLAnywhere.SAConnection' threw an exception. ---> Sap.Data.SQLAnywhere.SAException: Cannot find the language resource file (dblgen17.dll).
at Sap.Data.SQLAnywhere.SAUnmanagedDll..ctor()
at Sap.Data.SQLAnywhere.SAUnmanagedDll.get_Instance()
at Sap.Data.SQLAnywhere.SAConnection..cctor()
--- End of inner exception stack trace ---
at Sap.Data.SQLAnywhere.SAConnection..ctor()
at SBCTest.SybaseTest.<Run>d__3.MoveNext()
dblgen17.dll is included in the SAP SQL Anywhere Database Client found here, and has been added to my project, with Build Action set to None, and Copy to Output Directory set to Copy Always.
The "missing file" dblgen17.dll can be found in /site/wwwroot/bin after publish, as expected, along with Sap.Data.SQLAnywhere.v4.5.dll.
Why does it still say that it's missing? My Google results point me to the fact that it might have something to do with the PATH variable, but since this is an Azure Function I'm not sure what to do here.
I also noted an additional, odd behavior, described below.
Sometimes, sporadically when re-publishing a non-altered code, I can also get this error message all of a sudden:
[Error] Sap.Data.SQLAnywhere.SAException (0x80004005)
at Sap.Data.SQLAnywhere.SAConnection.Open()
at SBCTest.SybaseTest.<Run>d__3.MoveNext()
How can I make my code recognize the file, and hopefully connect successfully?
In my case, it worked out by reseting IIS, this can be done via cmd, with the iisreset command.
Here's the solution that I found based on this SO answer and it actually worked!
/// <summary>
/// Updates PATH variable in hosting instance to allow referring to items in this project's /bin folder.
/// Very helpful with Azure.
/// </summary>
public static void CheckAddBinPath()
{
// find path to 'bin' folder
var binPath = Path.Combine(new string[] { AppDomain.CurrentDomain.BaseDirectory, "bin" });
// get current search path from environment
var path = Environment.GetEnvironmentVariable("PATH") ?? "";
// add 'bin' folder to search path if not already present
if (!path.Split(Path.PathSeparator).Contains(binPath, StringComparer.CurrentCultureIgnoreCase))
{
path = string.Join(Path.PathSeparator.ToString(), new string[] { path, binPath });
Environment.SetEnvironmentVariable("PATH", path);
}
}
Then in Application_Start
// Sometimes files aren't loaded properly from bin. Hint to the app to load from /bin, too.
CheckAddBinPath();

Error handler for MBassador message/event bus

I'm using MBassador 1.2.1 message/event bus. Works well. Except that I am getting this error message in my logs, repeated for each of my instantiated bus objects:
WARN: No error handler configured to handle exceptions during publication.
Error handlers can be added to any instance of AbstractPubSubSupport or via BusConfiguration.
Falling back to console logger.
The main project page shows this example line on a BusConfiguration object:
.addPublicationErrorHandler( new IPublicationErrorHandler{...} )
…yet neither my IDE nor I see any such method on the BusConfiguration class.
How should I go about installing an error handler for Mbassador?
Add it as another property when building the configuration bus:
IBusConfiguration config = new BusConfiguration()
.addFeature(Feature.SyncPubSub.Default())
.addFeature(Feature.AsynchronousHandlerInvocation.Default())
.addFeature(Feature.AsynchronousMessageDispatch.Default())
.setProperty(Properties.Common.Id, "Command Channel Bus")
.setProperty(Properties.Handler.PublicationError, new IPublicationErrorHandler() {
#Override
public void handleError(PublicationError error) {
}
});
I had the exact same issue as you and this solved my problem.

Move to Web API RC, Get: Method not found: 'System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_ServiceResolver()'

I moved a site from WebAPI Beta to WebAPI RC, and am now getting an error upon loading the site: Method not found: 'System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_ServiceResolver()'.
The error occurs the first time that I am trying to register my AutoFacWebApiDependencyResolver (per instructions here):
var resolver = new AutofacWebApiDependencyResolver(IoCManager.Container);
GlobalConfiguration.Configuration.DependencyResolver = resolver;
The stacktrace shows the following:
[MissingMethodException: Method not found: 'System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_ServiceResolver()'.]
System.Web.Http.GlobalConfiguration.<.cctor>b__0() +0
System.Lazy`1.CreateValue() +12775823
System.Lazy`1.LazyInitValue() +355
StatusBoard.Web.MvcApplication.RegisterDependencyInjection() in C:\path-tp-app\Global.asax.cs:125
StatusBoard.Web.MvcApplication.Application_Start() in C:\path-to-app\Global.asax.cs:75
Based on this, it appears that the error is occurring during initialization of the static GlobalConfiguration class. When I drill down into the source for that class, I see the following:
private static Lazy<HttpConfiguration> _configuration = new Lazy<HttpConfiguration>((Func<HttpConfiguration>) (() =>
{
local_0 = new HttpConfiguration((HttpRouteCollection) new HostedHttpRouteCollection(RouteTable.Routes));
local_0.get_ServiceResolver().SetService(typeof (IBuildManager), (object) new WebHostBuildManager());
return local_0;
}));
private static Lazy<HttpControllerDispatcher> _dispatcher = new Lazy<HttpControllerDispatcher>((Func<HttpControllerDispatcher>) (() => new HttpControllerDispatcher(GlobalConfiguration._configuration.Value)));
public static HttpConfiguration Configuration
{
get
{
return GlobalConfiguration._configuration.Value;
}
}
The fourth line here seems to be the issue - it is trying to call a get_ServiceResolver() method that no longer exists in the HttpConfiguration class (should be DependncyResolver instead, probably).
Is this just a bug with the RC for WebAPI? Is there some way that I can get around this? Or am I stuck in some DLL/Nuget hell (and if so, how can I extricate myself)?
be sure to include the correct nuget package (RC!) and install the new mvc4rc on the machine where you build your package.
Dependency Resolution has been completely re-written in RC. Best is to uninstall beta DLLs and then your problems most likely go away.
Just uninstall the one flagged as "(bundle)" in windows' "Uninstall a program".

The type initializer for 'NHibernate.Cfg.Configuration' threw an exception

I am using FluentNHibernate and during the configuration phase I am getting the following error:
Here is the configuration:
public static ISessionFactory CreateSessionFactory()
{
return
Fluently.Configure().Database(
MsSqlConfiguration.MsSql2000.ConnectionString(
c => c.FromConnectionStringWithKey("HighOnCodingConnectionString")))
.Mappings(m =>
m.FluentMappings.AddFromAssemblyOf())
.BuildSessionFactory();
}
And here is the error:
[failure] when_instantiating_a_session_factory.should_be_able_to_create_a_session_factory
TestCase 'when_instantiating_a_session_factory.should_be_able_to_create_a_session_factory'
failed: The type initializer for 'NHibernate.Cfg.Configuration' threw an exception.
System.TypeInitializationException
Message: The type initializer for 'NHibernate.Cfg.Configuration' threw an exception.
Source: NHibernate
StackTrace:
at NHibernate.Cfg.Configuration..ctor()
c:\FluentNHibernate\src\FluentNHibernate\Cfg\FluentConfiguration.cs(25,0): at FluentNHibernate.Cfg.FluentConfiguration..ctor()
c:\FluentNHibernate\src\FluentNHibernate\Cfg\Fluently.cs(16,0): at FluentNHibernate.Cfg.Fluently.Configure()
C:\Projects\highoncodingmvc\src\highoncoding\src\HighOnCoding.BusinessObjects\Factories\SessionFactory.cs(17,0): at HighOnCoding.BusinessObjects.Factories.SessionFactory.CreateSessionFactory()
C:\Projects\highoncodingmvc\src\highoncoding\src\HighOnCoding.TestSuite\Configuration\TestFluentNHiberate.cs(17,0): at HighOnCoding.TestSuite.Configuration.when_instantiating_a_session_factory.should_be_able_to_create_a_session_factory()
Inner Exception
System.IO.FileLoadException
Message: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source: NHibernate
StackTrace:
at NHibernate.Cfg.Configuration..cctor()
Here is the log information from FusionLog thing:
* Assembly Binder Log Entry (6/21/2009 # 12:49:38 PM) *
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Projects\highoncodingmvc\src\highoncoding\src\HighOnCodingConsole\bin\Debug\HighOnCodingConsole.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = D9SKQBG1\AzamSharp
LOG: DisplayName = NHibernate.XmlSerializers, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///C:/Projects/highoncodingmvc/src/highoncoding/src/HighOnCodingConsole/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\highoncodingmvc\src\highoncoding\src\HighOnCodingConsole\bin\Debug\HighOnCodingConsole.exe.Config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: NHibernate.XmlSerializers, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Projects/highoncodingmvc/src/highoncoding/src/HighOnCodingConsole/bin/Debug/NHibernate.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/Projects/highoncodingmvc/src/highoncoding/src/HighOnCodingConsole/bin/Debug/NHibernate.XmlSerializers/NHibernate.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/Projects/highoncodingmvc/src/highoncoding/src/HighOnCodingConsole/bin/Debug/NHibernate.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/Projects/highoncodingmvc/src/highoncoding/src/HighOnCodingConsole/bin/Debug/NHibernate.XmlSerializers/NHibernate.XmlSerializers.EXE.
LOG: All probing URLs attempted and failed.
Looks like you've compiled against one version of an assembly, but at execution time it's finding another and complaining. I suggest you turn on Fusion logging to work out what's going on - in particular, the exact assembly which is causing problems!
I know this is long since resolved, but having had this problem myself today, I found this as my personal solution and thought I'd share the knowledge:
https://forum.hibernate.org/viewtopic.php?p=2399679
From the post:
"My debugger in Visual Studio was set to break on all exceptions, adjusting the exception settings fixed my problem."
Also led me to:
http://www.codewrecks.com/blog/index.php/2008/02/13/sgenexe-and-strongly-named-assemblies/
"After some search I found that the xxxx.XmlSerializers assembly is a pregenerated assembly that the xmlserializers looks for before attempting to generate one at runtime..."