'System.TypeInitializationException' occurred in RdKafka.dll - c#

when i try to implement a consumer like the example mentionened in readme section the following
line
var config = new Config() { GroupId = "example-csharp-consumer" };
causes this exception
System.TypeInitializationException was unhandled
HResult=-2146233036
Message=Der Typeninitialisierer für "RdKafka.Internal.LibRdKafka" hat eine Ausnahme verursacht.
Source=RdKafka
TypeName=RdKafka.Internal.LibRdKafka
StackTrace:
bei RdKafka.Internal.LibRdKafka.conf_new()
bei RdKafka.Internal.SafeConfigHandle.Create()
bei RdKafka.Config..ctor()
bei kafka_consumer_example.Program.Main(String[] args) in C:\Users\stc\Development\git\kafka-consumer-example\Program.cs:Zeile 18.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2146233052
Message=Die DLL "librdkafka": Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden.
Source=RdKafka
TypeName=""
StackTrace:
bei RdKafka.Internal.LibRdKafka.NativeMethods.rd_kafka_version()
bei RdKafka.Internal.LibRdKafka.version()
bei RdKafka.Internal.LibRdKafka..cctor()
InnerException:
the stacktrace looks like
in RdKafka.Internal.LibRdKafka.NativeMethods.rd_kafka_version()
in RdKafka.Internal.LibRdKafka.version()
in RdKafka.Internal.LibRdKafka..cctor()
i integrated the library via Nuget from https://www.nuget.org/packages/RdKafka/0.9.1-ci-131
can anyone tell me which assemblie i'm missing ?

You need install Visual C++ Redistributable Packages for Visual Studio 2013
https://www.microsoft.com/en-US/download/details.aspx?id=40784

Related

Getting IllegalFormatName exception in messageQueue.BeginReceive

I am trying to create a eventhandler for a msmq message router and I almost just copied a online example from msdn library
example 2.
But when I invoke messageQueue.BeginReceive() I get a IllegalFormatName exception.
I am using a private queue
Using VS 2015 on windows 10
Solution is using .Net 4.5.2
I got no problems sending messages to any of my private queues or reading from them if I use messageQueue.Receive()
Exception details below:
System.Messaging.MessageQueueException was unhandled
ErrorCode=-2147467259 HResult=-2147467259 Message=Formatnavnet er
ugyldigt. Source=System.Messaging StackTrace:
ved System.Messaging.MessageQueue.MQCacheableInfo.get_ReadHandle()
ved System.Messaging.MessageQueue.ReceiveAsync(TimeSpan timeout, CursorHandle cursorHandle, Int32 action, AsyncCallback
callback, Object stateObject)
ved System.Messaging.MessageQueue.BeginReceive()
ved MYFirstMSMQ.Program.Main(String[] args) in ......Visual Studio 2015\Projects\FirstQueue_bluff_city\ConsoleApplication1\Program.cs:linje
68
ved System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
ved System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
ved Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
ved System.Threading.ThreadHelper.ThreadStart_Context(Object state)
ved System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
ved System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
ved System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
ved System.Threading.ThreadHelper.ThreadStart() InnerException:
Sorry about the Message - windows returns some messages in my native language

BIDSHelper2014 1.7.0.0 (BimlEngine) throws <>z__Aspects

I have a code which works fine with 1.6.6 version. For example this line:
var root = new AstRootNode(null);
I decided to update the library to 1.7.0.0 and now I get "The type initializer for '<>z__Aspects' threw an exception.". If someone else faced this problem, please help solve it.
Inner Exception:
{"Could not load file or assembly 'Utility, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Utility, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"}
Stack Trace:
at Varigence.Utility.ComponentModel.VulcanNotifyPropertyChanged..ctor()
at Varigence.Languages.Biml.AstNode..ctor(IFrameworkItem parentItem)
at Varigence.Languages.Biml.AstRootNode..ctor(IFrameworkItem parentItem)
at ConsoleApplication1.Program.Main(String[] args) in c:\Users\Nikolai\Documents\Visual Studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

dll Matlab instance throw an exception while running release in c#

My c# program uses Matlab dll and it works find as long as I run it in Debug mode.
but as I trying to run it in Release mode it crashes immediately when creating it's instance.
It trows TypeInitializationException.
Thanks for your help
StackTrace:
"at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Turbo_Neuron.ANNController..ctor()
in C:\\Users\\Eli\\Desktop\\....\\MyProject\\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()"
And it sais:
The type initializer for 'MatlabANNComp.MatlabANN' threw an exception.
StachTrace 2:
at MatlabANNComp.MatlabANN..ctor()
at Turbo_Neuron.ANNController..ctor() in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\Matlab_Layer\ANNController.cs:line 49
at Turbo_Neuron.TNController..ctor(pnl_main form) in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\Logic_Layer\TNController.cs:line 49
at Turbo_Neuron.pnl_main..ctor() in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\View_Layer\Turbo_Form.cs:line 29
at Turbo_Neuron.Program.Main() in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Exception messages:
Exception.Message =
"The type initializer for 'MatlabANNComp.MatlabANN' threw an exception."
InnerException.Message =
{"Could not load file or assembly 'MWArray, Version=2.10.1.0,
Culture=neutral, PublicKeyToken=e1d84a0da19db86f'
or one of its dependencies. An attempt was made
to load a program with an incorrect format."}
InnerException.InnerException = null
An attempt was made to load a program with an incorrect format
this is the key, and it means you are mixing platforms somwhow. A 32bit process cannot load 64bit dlls and vice-versa. If a process tries to do so anyway, it throws the above exception.
You say you only changed from Debug->Release, so it's likely something that has to do with platform changed as well. Compare settings for all projects in the Configuration Manager. They all should be x86 or x64 (not AnyCPU). Which one depends on your matlab dll's platform (set when building it).

(SEH)Exception initializing Nlog

I get the error at the end when I try to start a project I'm working on from Visual Studio. It worked fine until a few hours ago. After some minor unrelated changes it stopped working when starting from Visual Studio. It works fine when run from explorer. Even old version vom revision control (where this part of the code is exactly the same and has worked without any problems) behave the same way so it doesn't seem to be a problem in my code.
The code at Program.cs:line 14 is the following:
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
Any ideas on how to solve this?
System.TypeInitializationException was unhandled
Message=The type initializer for ...' threw an exception.
Source=...
TypeName=...
StackTrace:
at ....Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Runtime.InteropServices.SEHException
Message=External component has thrown an exception.
Source=mscorlib
ErrorCode=-2147467259
StackTrace:
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()
at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext()
at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext()
at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at NLog.Config.XmlLoggingConfiguration.get_AppConfig()
at NLog.LogFactory.get_Configuration()
at NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey)
at NLog.LogFactory.GetLogger(String name)
at NLog.LogManager.GetCurrentClassLogger()
at ....Program..cctor() in C:\...\Program.cs:line 14
InnerException:
Check the following post on the Avira support site for details of the problem and a work around. The issue is related to the last product update:
http://www.avira.com/en/support-for-business-knowledgebase-detail/kbid/805

Nhibernate 2.1 and mysql 5 - InvalidCastException on Setup

I am trying to use NHibernate with Spring.Net und mySQL 5. However, when setting up the connection and creating the SessionFactoryObject, I get this InvalidCastException:
NHibernate seems to cast MySql.Data.MySqlClient.MySqlConnection to System.Data.Common.DbConnection which causes the exception.
System.InvalidCastException wurde nicht behandelt.
Message="Das Objekt des Typs \"MySql.Data.MySqlClient.MySqlConnection\" kann nicht in Typ \"System.Data.Common.DbConnection\" umgewandelt werden."
Source="NHibernate"
StackTrace:
bei NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() in c:\CSharp\NH\nhibernate\src\NHibernate\Tool\hbm2ddl\SuppliedConnectionProviderConnectionHelper.cs:Zeile 25.
bei NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper) in c:\CSharp\NH\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaMetadataUpdater.cs:Zeile 43.
bei NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory) in c:\CSharp\NH\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaMetadataUpdater.cs:Zeile 17.
bei NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) in c:\CSharp\NH\nhibernate\src\NHibernate\Impl\SessionFactoryImpl.cs:Zeile 169.
bei NHibernate.Cfg.Configuration.BuildSessionFactory() in c:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:Zeile 1090.
bei OrmTest.Program.Main(String[] args) in C:\Users\Max\Documents\Visual Studio 2008\Projects\OrmTest\OrmTest\Program.cs:Zeile 24.
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
I am using the programmatically setup approach in order to get a quick NHibernate Setup. Here is the setup Code:
Configuration config = new Configuration();
Dictionary props = new Dictionary();
props.Add("dialect", "NHibernate.Dialect.MySQL5Dialect");
props.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
props.Add("connection.driver_class", "NHibernate.Driver.MySqlDataDriver");
props.Add("connection.connection_string", "Server=localhost;Database=orm_test;User ID=root;Password=password");
props.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Spring.ProxyFactoryFactory, NHibernate.ByteCode.Spring");
config.AddProperties(props);
config.AddFile("Person.hbm.xml");
ISessionFactory factory = config.BuildSessionFactory();
ISession session = factory.OpenSession();
Is something missing? I downloaded the current mysql Connector from the mysql Website.
Shame on me, I downloaded accidently a wrong mysql connector and not the latest version: http://dev.mysql.com/downloads/connector/net/6.0.html
Sorry!

Categories

Resources