Microsoft.CognitiveServices.Speech is not working after publishing application - c#

Getting following exception when loading :
speechRecognizer = new Microsoft.CognitiveServices.Speech.SpeechRecognizer(config);
Inner exception : InnerException = {"Unable to load DLL
'Microsoft.CognitiveServices.Speech.csharp.bindings.dll': The
specified module could not be found. (Exception from HRESULT:
0x8007007E)"}
Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE.SpeechConfig_FromSubscription(String
jarg1, String jarg2) at
Microsoft.CognitiveServices.Speech.Internal.SpeechConfig.FromSubscription(String
subscription, String region) at
Microsoft.CognitiveServices.Speech.SpeechConfig.FromSubscription(String
subscriptionKey, String region) |ERROR|The type initializer for
'SWIGExceptionHelper' threw an exception. 2019-01-03
16:02:50.2178|ERROR|The type initializer for
'Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE'
threw an exception.

As the exception says, you are missing "Microsoft.CognitiveServices.Speech.csharp.bindings.dll" . You have to include the dll in the project and mark it as part of the deploy. Make sure it appears in the deployed folder in the IIS , copy it manually as last option.

Related

An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributo

when i create new project anglar and run the app i get this err
An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.OpenIddict.AbpOpenIddictDomainModule, Volo.Abp.OpenIddict.Domain, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating Volo.Abp.OpenIddict.Tokens.TokenCleanupBackgroundWorker -> Volo.Abp.DistributedLocking.MedallionAbpDistributedLock.. See the inner exception for details.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.OpenIddict.Tokens.TokenCleanupBackgroundWorker -> Volo.Abp.DistributedLocking.MedallionAbpDistributedLock.
Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Volo.Abp.DistributedLocking.MedallionAbpDistributedLock' can be invoked with the available services and parameters:
Cannot resolve parameter 'Medallion.Threading.IDistributedLockProvider distributedLockProvider' of constructor 'Void .ctor(Medallion.Threading.IDistributedLockProvider, Volo.Abp.Threading.ICancellationTokenProvider, Volo.Abp.DistributedLocking.IDistributedLockKeyNormalizer)'.
v
Make sure you are running Redis. DistributedLocking refers to Redis in your error.

NotSupportedException is thrown when trying to save Emitted assembly

http://pastebin.com/n6G1jTHQ
My code creates a new assembly and module, and then emits a class SWT(within a new assembly) that should be exactly the same as SWTTFieldsclass.
Line 137, saves the assembly/module into a .dll, myAsmBuilder.Save("ModuleOne.dll"); throws the exception:
An unhandled exception of type 'System.NotSupportedException' occurred
in mscorlib.dll Additional information: Type 'SWT' was not completed.
Why I am getting this error ? What is missing in my emitted class ?
You have to call the TypeBuilder.CreateType Method for each TypeBuilder before saving the File.

System.TypeLoadException in C#

I have a C# application and I modified it to show a new window using the lines:
private void button1_Click(object sender, EventArgs e)
{
WelcomeScreen channelBar = new WelcomeScreen(true, "http://www.trade-ideas.com/cms_static/ChannelBar/channelbar.html");
}
It compiles just fine, but when I run the app and click on the button, I get this error:
An unhandled exception of type 'System.TypeLoadException' occurred in WindowsFormsApplication1.exe
Additional information: Could not load type 'TradeIdeas.TIProData.OddsMakerColumnConfiguration' from assembly 'TIProData, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
What doesn't make any sense is that WelcomeScreen comes from TIProGUI.dll not TIProData. I have included both dll's in the project along with a 3rd dll:
using TradeIdeas.TIProData;
using TradeIdeas.TIProGUI;
using TradeIdeas.TIProData.Configuration;
Also, when I run the project initially, I see a very strange message. It says:
Loading symbols from TIProData.dll from:
\\MissionControl\Users\KLewis2\Documents\CVSRoot\C_Sharp\TIProData\Obj\Release
Needless to say, there is no path to that from my machine.
Any clues as to what is causing this would be greatly appreciated.
There are many reasons and one of common once is exceptions in static initializers.
To diagnose - debug program with exceptions set to "break when thrown" and disabled "my code only". When exception happen take note of call stack and check all exceptions thrown from static initializers.
Location of options:
Tools-> Options -> Debug -> My Code only (uncheck)
Debug -> Exceptions -> Common Language Runtime Exceptions (check "thrown")
Sample code that will cause that error:
class MyClass
{
static int value = ReadFromConifg();
static int ReadFromConifg()
{...
throw new ConfigMissingException();
}
}

Using Mono.Data.Sqlite on Windows in Visual Studio 2013

EDIT: Ok, I noticed I changed the output folder of the project and put the DLL into the old output folder. After putting it in the right output folder Open() works! I get another exception later, but I guess I can fix that...
I am working on a program that is running on .NET on Windows and on Mono on Linux/Mac. I'm trying to add a very simple SQLite logger to it. I added the Mono.Data.Sqlite.dll (of Mono 3.10) to the project references in Visual Studio 2013 and copied a sqlite3.dll (http://www.sqlite.org/2014/sqlite-dll-win32-x86-3080701.zip) into the debug folder (where the program exe is created).
This is my test code:
using Mono.Data.Sqlite;
using System.Data;
namespace Program.Logging
{
class MyLogger
{
public void TestMethod()
{
string connectionString = "URI=file:SqliteTest.db";
IDbConnection dbcon;
dbcon = (IDbConnection)new SqliteConnection(connectionString);
dbcon.Open();
}
}
}
But when I try to run the code I get this error at dbcon.Open():
An unhandled exception of type 'System.EntryPointNotFoundException'
occurred in Mono.Data.Sqlite.dll
Additional information: Der Einstiegspunkt "sqlite3_next_stmt" wurde
nicht in der DLL "sqlite3" gefunden. (The entry point
"sqlite3_next_stmt" was not found in the DLL "sqlite3".)
What am I doing wrong?
EDIT:
string connectionString = "Data Source=file:SqliteTest.db";
An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll. Additional information: URI-Formate werden nicht
unterstützt. (URI formats aren't supported.)
string connectionString = "URI=file:SqliteTest.db,version3";
An unhandled exception of type 'System.ArgumentException' occurred in
Mono.Data.Sqlite.dll. Additional information: Invalid ConnectionString
format for parameter "version3"
It appears you are using the wrong connection string format. The documentation specifies the connection string formats:
[1.1 profile and the old assembly]
URI=file:/path/to/file
[2.0 profile in the new assembly]
Data Source=file:/path/to/file
Since you are targeting sqlite3, I guess you should be using the 2.0 profile format.
string connectionString = "Data Source=file:SqliteTest.db";
They also mention that in the 1.1 profile, sqlite version 2 is used by default, you would have to specify the version if you want to use if you use the old format.
string connectionString = "URI=file:SqliteTest.db,version=3";

Rebuilding the AddressBook example in protobuf-csharp-port 2.4.1.473

I have sucessfully built the example AddressBook project in protobuf-csharp-port-2.4.1.473-source and have even got it to work with the C++ example from the protobuf-2.4.1-win32. However, when I try to regenerate the AddressBookProtos.cs file and execute it, I encounter the following runtime problem.
Options:
L: List contents
A: Add new person
Q: Quit
Action? a
Exception executing action: System.TypeInitializationException: The type initializer
for 'Google.ProtocolBuffers.Examples.AddressBook.AddressBook' threw an exception. --->
System.TypeInitializationException: The type initializer
for 'Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos' threw an exception. --->
System.ArgumentException: Invalid embedded descriptor for "tutorial/addressbook.proto". --->
Google.ProtocolBuffers.Descriptors.DescriptorValidationException: tutorial/addressbook.proto:
Dependencies passed to FileDescriptor.BuildFrom() don't match those listed in the
FileDescriptorProto.
at Google.ProtocolBuffers.Descriptors.FileDescriptor.BuildFrom(FileDescriptorProto proto,
FileDescriptor[] dependencies)
at Google.ProtocolBuffers.Descriptors.FileDescriptor.InternalBuildGeneratedFileFrom(Byte[]
descriptorData, FileDescriptor[] dependencies, InternalDescriptorAssigner descriptorAssigner)
I tried to generate the AddressBookProtos.cs from protobuf-csharp-port-2.4.1.473-release-binaries, using protos\tutorial\addressbook.proto but it seems to be missing the namespace and umbrella_classname options. Also, the version numbers listed in src\AddressBook\AddressBookProtos.cs that came in protobuf-csharp-port-2.4.1.473-source says it is "2.3.0.277".

Categories

Resources