exception while open connection to TVServer (1 Viewer)

nu_81

Portal Pro
November 15, 2009
315
74
Rheinberg
Home Country
Germany Germany
Hello,
I try to realise my first MediaPortal Project and have an issue while coding the first lines.
I will connect from a 3rd Service class to the TV Service with the following code:

RemoteControl.HostName = "localhost";
//get the location of the database..

string connStr;
string provider;
IController controller = RemoteControl.Instance;
controller.GetDatabaseConnectionString(out connStr, out provider);

//set the connection string
ProviderFactory.SetDefaultProviderConnectionString(connStr);
In the last line I get an exception. Unfortunally I got it in german, but I hope you can read some information on that:

System.TypeInitializationException wurde nicht behandelt.
Message=Der Typeninitialisierer für "Gentle.Framework.ProviderFactory" hat eine Ausnahme verursacht.
Source=Gentle.Framework
TypeName=Gentle.Framework.ProviderFactory
StackTrace:
bei Gentle.Framework.ProviderFactory.SetDefaultProviderConnectionString(String connectionString)
bei ConsoleApplication1.Program.Main(String[] args) in C:\Users\xxx\Desktop\MP\TVAnytime\Test\ConsoleApplication1\ConsoleApplication1\Program.cs:Zeile 34.
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: System.Reflection.TargetInvocationException
Message=Ein Aufrufziel hat einen Ausnahmefehler verursacht.
Source=mscorlib
StackTrace:
bei System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
bei System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei Gentle.Common.MethodInvoker.Invoke(Object target, Object[] parameterValues)
bei Gentle.Common.MethodInvokable.Invoke(Object target)
bei Gentle.Common.MethodDispatcher.Invoke(Object target, Hashtable parameters)
bei Gentle.Common.CallbackTarget.Configure(Object target, XmlNode node)
bei Gentle.Common.CallbackTarget.Configure(Object target, XmlNodeList nodes)
bei Gentle.Common.ConfigurationMap.Configure(IList handlers, Object obj)
bei Gentle.Common.Configurator.Configure(String configStoreName, Object instance)
bei Gentle.Common.Configurator.Configure(Object instance)
bei Gentle.Framework.ProviderRegistry..ctor()
bei Gentle.Framework.ProviderFactory..cctor()
InnerException: System.Reflection.ReflectionTypeLoadException
Message=Mindestens ein Typ in der Assembly kann nicht geladen werden. Rufen Sie die LoaderExceptions-Eigenschaft ab, wenn Sie weitere Informationen benötigen.
Source=mscorlib
StackTrace:
bei System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
bei System.Reflection.Assembly.GetTypes()
bei Gentle.Framework.ProviderRegistry.GetProviderInfo(Assembly assembly)
bei Gentle.Framework.ProviderRegistry.GetProviderInfo(String assemblyName)
bei Gentle.Framework.ProviderRegistry.RegisterProvider(String name, String assembly)
InnerException:
I also tried to post this in the german section, but I got no answer.

Thank you in advance.
Nu
 

nu_81

Portal Pro
November 15, 2009
315
74
Rheinberg
Home Country
Germany Germany
Hello,
Where can I get some support for my issue?
Is there any other section or Forum for my kind of question?
I have an idea for a MePo extension and for now I'm very motivated to realize it.
I would be very thankful for any idea.
Ciao Nu
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello

    Here is an okay place for this question.
    I think it would be good if you could explain exactly what you're trying to do, because in general it would be better if you could let the TV service handle the database connection and use the TVDatabase.dll and TvBusinessLayer.dll to access the data you need. If you need to use custom queries then it makes sense to have your own connection.

    To directly address the problem...
    For a start, make sure you have the Gentle.NET provider DLLs in the right place. You need all of the following DLLs:
    Gentle.Common.dll
    Gentle.Framework.dll
    Gentle.Provider.MySQL.dll
    Gentle.Provider.SQLServer.dll
    MySql.Data.dll

    I'm not sure exactly what is going wrong, but since Gentle.NET is open source I would suggest to check the source code to work out why the exception is being thrown. The source code is here:
    https://github.com/MediaPortal/MediaPortal-1/blob/master/Common-MP-TVE3/External/Gentle.NET/Source/
    https://github.com/MediaPortal/Medi...urce/Gentle.Framework/Core/ProviderFactory.cs

    I hope that helps at least a little.

    mm
     

    nu_81

    Portal Pro
    November 15, 2009
    315
    74
    Rheinberg
    Home Country
    Germany Germany
    Hello,
    Thank you for your reply.
    My goal is to create a service which read the EPG of a selected channel, qualify every entry (imdb rating, Already recorded, etc) and to mark selective Programs for recording.
    So new, good Movies will be automaticly recorded on the main paytv channels.
    This service should work in the background every x days. Further I would like to create a Webservice to manage the selected recording marks and programs which could not be qualified. this should work by a Webbrowser and in future by a MePo PlugIn.
    At the beginning there would by much movies to deselect as "already recorded/ already seen" but in future it should be very helpful to me.

    My idea is to create a dll which can be used by my services.


    I read that there are 2 possibilIties to do that.
    1) to use a TV Plugin (I guess that in this case i am not able to use it by my services)
    2) to connect to the TV Service with Gentle.net

    How can I connect to the TV Service by Tvdatabase.dll ?

    Thank you in advance.
    Nu
     
    Last edited:

    nu_81

    Portal Pro
    November 15, 2009
    315
    74
    Rheinberg
    Home Country
    Germany Germany
    So,
    I don't know why but after copying the dll from my real HTPC to the devolopment maschine now it working.
    The problem occured also when I try to connect by TvBusinessLayer.dll. The reason should b because it also uses then Gentle.Framework.
    So now it works and thank you again.
     

    Users who are viewing this thread

    Top Bottom