Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

Complex .dll Calling problem

Discussing issues that occur during plugin development.

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
jamal
Posts: 3
Joined: February 13th, 2006, 10:44 pm

Complex .dll Calling problem

Post by jamal »

I've got a problem. LCD Smartie hangs when I try to make a call to a .NET 2.0 dll.

I've got a set of unit tests that run fine, but no luck from LCD smartie :(

The plugin is for MediaPortal - it's not my plugin but I'm making some headway in getting it working. But now I'm stuck... Is there a log file somewhere for LCD smartie? I've specifed one in the config file but nothing gets written. I've also got logging turned on in my dll, and it logs just fine - but when it calls out to the other dll (that I deploy at the same time) everything just grinds to a halt :(

Anyone else had any problems? I've written a test .NET 2 dll and it all works fine - so I can only assume it's something to do with the dll I deploy with the plugin (ECP2Assembly.dll). Problem is, ECP2 doesn't do any logging either!

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

Let me know the following:
You are about to build a plugin for media portal ok?
Does the LCD Smartie complains for anything on the screen when you calling the dll?
Can you add the a simple log file to your dll to see where is the stop point?

I believe that somthing is going wrong with the dll code not from the Smartie side. :wink:

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

You can use something like the following to dynamically create a text file
and add a line s.WriteLine() on function beginning and on function end to your dll.

Code: Select all

Imports System.IO 'declare namespace

Public Class Form1
    Inherits System.Windows.Forms.Form


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fs As New FileStream("C:\file.txt", FileMode.Create, FileAccess.Write)
        'declaring a FileStream create txt file and give write access 
        Dim s As New StreamWriter(fs) ' file stream creation
        s.BaseStream.Seek(0, SeekOrigin.End) 'move forward
        s.WriteLine("Line one added.") 'Write
        s.WriteLine("Code provided by limbo.") 'write
        s.Close()
        'closing the file
    End Sub
End Class
So if you see that a function has begun but not ended there is a suspicious position on your code.


The only thing needed to make the above code working is to make public the declares. :)

jamal
Posts: 3
Joined: February 13th, 2006, 10:44 pm

Post by jamal »

lol. Thank you for the quick response - and the coding 101!

I'm using a standard logging framework (log4net), so I know exactly where the code fails. It's as soon as it tries to call the external dll (ECP2Assembly).

There are no exceptions thrown, as I have a try-catch block around the call. LCD Smartie just hangs :(

I'm not implying that I think LCD Smartie is doing anything wrong, but I know the plugin code works fine when I call it from NUnit, or from another piece of .lNET code - so I'm confused as to why it doesn't work in LCD Smartie.

I thought it could be because there was an uncaught exception being thrown (I saw a reference to it in the FAQ I think, saying an uncaught exception will cause LCD Smartie to hang) but I'm now confident it isn't that as I've wrapped the code in a try-catch for System.Exception.

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

I can't say :smt017

Maybe something is wrong with the bridge between LCD Smartie and .NET dlls.
BUT NEVER FACED BEFORE THIS KIND OF PROBLEM! :shock:

Can you try to light-out your code (if its possible) and test again the whole build?

jamal
Posts: 3
Joined: February 13th, 2006, 10:44 pm

Post by jamal »

I'm happy to try anything - but not sure what you mean by "light-out your code"?

I've tried taking absolutely everything out of the class, but it still fails as soon as it tries to call anything in the external dll.

If it makes any difference, the external dll uses remoting... :?

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

:smt022 There is a problem for real...

I'll check some things and if I have an answer I'll hit you back here... :?

hobbes
Posts: 1
Joined: June 22nd, 2006, 10:20 pm

Post by hobbes »

did you manage to overcome this problem?

I am having a similar problem. Created a C# .NET DLL which interfaces with media center to display media center status information.

Works great from a .NET Windows Form application, running as plugin in LCD Smartie then no MCE events are received....

The methods in the DLL are called by LCD Smartie as I can see when adding static text to the DLL.

I think it might have something to do with COM ...?

Post Reply