It is currently March 28th, 2024, 11:45 am

Debugging a plugin

Get help with creating, editing & fixing problems with skins
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Debugging a plugin

Post by chilio »

Heyhey,
I'm trying to debug a plugin I'm building. The problem I'm facing at the moment is that the logs that should be written don't seem to appear anywhere. Is there a bug that won't let me initialize the plugin or am I looking in the wrong places for the log to appear? (I looked into the log in "manage rainmeter" -> "open log".)
Oh, and should I use a certain target framework? (.NET core/.NET framework/???)

Code: Select all

namespace PluginParentChild
{
    public static class Plugin
    {
        private static API api;

        [DllExport]
        public static void Initialize(ref IntPtr data, IntPtr rm)
        {
            api = new API(rm);
            api.Log(API.LogType.Notice, "Starting plugin");
            ...
        }
        ...
    }
}

Code: Select all


[MeasureImageMasker]
Measure = Plugin
Plugin = ImageMerger.dll
Type = ImageMaskMeasure

[MeasureImage]
Measure = Plugin
Plugin = ImageMerger.dll
Type = ImageMeasure
Parent = ImageMasker
ImageName = MeasureImagePath
PreserveAspectRatio = 1
X = (#BorderSize#+#ShadowSize#)
Y = (#BorderSize#+#ShadowSize#)
W = #ImageWidth#
H = #ImageHeight#
DynamicVariables=1

[MeasureMask]
Measure = Plugin
Plugin = ImageMerger.dll
Type = ImageMeasure
Parent = ImageMasker
ImageName = #@#circle.png
PreserveAspectRatio = 2
X = 0
Y = 0
W = #Width#
H = #Height#
DynamicVariables=1

[MeasureResult]
Measure = Plugin
Plugin = ImageMerger.dll
Type = ImageResultMeasure
Parent = ImageMasker
ImageName = #@#result.png
X = 0
Y = 0
W = #Width#
H = #Height#
DynamicVariables=1

[Image]
Meter=IMAGE
ImageName = #@#result.png
X = 0
Y = 0
W = #Width#
H = #Height#
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Debugging a plugin

Post by balala »

Try restarting Rainmeter. Not sure this will help, but it could.
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Debugging a plugin

Post by chilio »

Last night I had the same result, so I already restarted my pc and rainmeter since the first time ^^'
Will try again later (don't have my pc here), but any other ideas?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Debugging a plugin

Post by balala »

chilio wrote:but any other ideas?
Not too much. I just noticed such behavior, that sometimes (rarely), the log doesn't show anything and in such cases a restart of Rainmeter helped. But if it didn't, well, no more ideas...
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Debugging a plugin

Post by chilio »

In that case I'll try to build the connection to the api again in hopes it works I guess... (I mean, when I use one of the templates and only add a log, it should work..)

Any ideas what could've gone wrong building the project? (Other framework, bit version or something like that?)
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Debugging a plugin

Post by balala »

Sorry...
:confused: :confused:
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: Debugging a plugin

Post by SilverAzide »

chilio wrote:In that case I'll try to build the connection to the api again in hopes it works I guess... (I mean, when I use one of the templates and only add a log, it should work..)

Any ideas what could've gone wrong building the project? (Other framework, bit version or something like that?)
The log you are writing to (api.Log(API.LogType.Notice, "Starting plugin");) is not a file, it is the Log tab in the Rainmeter About dialog.
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Debugging a plugin

Post by chilio »

SilverAzide wrote:The log you are writing to (api.Log(API.LogType.Notice, "Starting plugin");) is not a file, it is the Log tab in the Rainmeter About dialog.
chilio wrote:I looked into the log in "manage rainmeter" -> "open log".
You mean here right? There does appear a lot of logging, but no logging of my plugin, not even from the line in the initialize function.
log screen.PNG
Last edited by chilio on March 16th, 2018, 9:19 pm, edited 1 time in total.
chilio
Posts: 48
Joined: January 26th, 2018, 9:56 am

Re: Debugging a plugin

Post by chilio »

chilio wrote:In that case I'll try to build the connection to the api again in hopes it works I guess... (I mean, when I use one of the templates and only add a log, it should work..)

Any ideas what could've gone wrong building the project? (Other framework, bit version or something like that?)
Anyone out here with experience building plugins?
What I tried so far:
- naive programming assuming logging worked
- building a new plugin from empty.cs, while only adding the logging code (api.Log(API.LogType.Notice, "Starting plugin");)
- build both versions in 64bit, release mode and put them in the plugins folder.

Both versions are used by my skin (I can't delete the plugin while the skin runs and I don't get error 126 when referring to them), but the initialize function in the plugin doesn't seem to be called. (The api.log doesn't work at least.)


My other idea is now to clone a working plugin with logging and try to build it. Does one of you know a simple plugin with logging that I can clone (from github or something like that)?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Debugging a plugin

Post by balala »

I don't know if this will help, but have you seen this: https://docs.rainmeter.net/developers/#CreatePlugin?
Post Reply