1 Pages (9 items)
Problem running plugin - Messages
#1 Posted: 7/5/2010 1:17:06 PM
I am exploring plugins. I followed the directions of the tutorial using the VB Express.
The project compiles successfully but when I launch SMath I get an error message
"Error occured while trying to load third party assembly. Plugin disabled"
"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)"
I cut and pasted the New Guid("a37cba83‐b69c‐4c71‐9992‐55ff666763bd").
Has anyone been successfull in duplicating the plugin tutorial?
The project compiles successfully but when I launch SMath I get an error message
"Error occured while trying to load third party assembly. Plugin disabled"
"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)"
I cut and pasted the New Guid("a37cba83‐b69c‐4c71‐9992‐55ff666763bd").
Has anyone been successfull in duplicating the plugin tutorial?
Ed
#2 Posted: 7/6/2010 11:27:57 AM
Since I created that tutorial a few weeks ago, I have yet to hear if anyone has successfully completed the tutorial. So, I would also like to know if anyone has been able to duplicate it. Anyone?
As to the problem you have encountered above, I am not sure what could be causing the error. As far as I know the GUID you used should work for all versions of Smath. Perhaps you could post your source code? That may help us to determine the source of the error. Also, what version of Smath are you using?
Andrey, do you have any idea what would cause this error?
Will
As to the problem you have encountered above, I am not sure what could be causing the error. As far as I know the GUID you used should work for all versions of Smath. Perhaps you could post your source code? That may help us to determine the source of the error. Also, what version of Smath are you using?
Andrey, do you have any idea what would cause this error?
Will
Will Massie
Mechanical Engineer
Oregon, USA
#3 Posted: 7/6/2010 5:46:19 PM
Seems this is an error with specified GUID in dependences or into the AssebmblyInfo.vb file. If it is possible, please, copy every lines of code with GUIDS of your solution here on the forum - we will check it.
Regards.
Regards.
#4 Posted: 7/6/2010 10:28:32 PM
It turns out you cant' cut and paste the GUI from the tutorial doc to the VB Express IDE. I deleted the New Guid parameter and put it in manually.
New Guid("a37cba83-b69c-4c71-9992-55ff666763bd")
It compiles and load but when I try to execute the function I get an error message
combin(5,3)=
Unable to cast object
of type 'SMath.Manager.Term'
to type 'Systems.Collection.Generic.IEnumerable`1[SMath.Manager.Term]'
My source code is listed below.
Imports SMath.Manager
Imports SMath.Math
Public Class Class1
Implements IPluginHandleEvaluation, IPluginLowLevelEvaluation
Dim termInfos() As TermInfo
Dim asseblyInfos() As AssemblyInfo
Public ReadOnly Property Dependences As SMath.Manager.AssemblyInfo() Implements SMath.Manager.IPlugin.Dependences
Get
Return Me.asseblyInfos
End Get
End Property
Public Sub Initialize() Implements SMath.Manager.IPlugin.Initialize
Me.termInfos = New TermInfo() {
New TermInfo("combin", TermType.Function, 2, "(n, k) ‐ Returns the number of subsets (combinations) of k elements that can be formed from n elements.", FunctionSection.Unknown, True)
}
Me.asseblyInfos = New AssemblyInfo() {
New AssemblyInfo("Smath Studio", New Version(0, 88), New Guid("a37cba83-b69c-4c71-9992-55ff666763bd"))
}
End Sub
Public ReadOnly Property TermsHandled As SMath.Manager.TermInfo() Implements SMath.Manager.IPluginHandleEvaluation.TermsHandled
Get
Return Me.termInfos
End Get
End Property
#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub
' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
'End Sub
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
#End Region
Public Function ExpressionEvaluation(ByVal root As SMath.Manager.Term, ByVal args()() As SMath.Manager.Term, ByRef store As SMath.Manager.Store, ByRef result() As SMath.Manager.Term) As Boolean Implements SMath.Manager.IPluginLowLevelEvaluation.ExpressionEvaluation
If root.Type = TermType.Function And root.Text = "combin" And root.ChildCount = 2 Then
Dim arg1 As Term() = Decision.Preprocessing(args(0), store)
Dim arg2 As Term() = Decision.Preprocessing(args(1), store)
Dim answer As New List(Of Term)
answer.AddRange(arg1)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg1)
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Substraction, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(New Term([Operator].Multiplication, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Division, TermType.Operator, 2))
result = answer.ToArray()
Return True
End If
Return False
End Function
End Class
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
'The following GUID is for the ID of the typelib if this project is exposed to COM
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
'
New Guid("a37cba83-b69c-4c71-9992-55ff666763bd")
It compiles and load but when I try to execute the function I get an error message
combin(5,3)=
Unable to cast object
of type 'SMath.Manager.Term'
to type 'Systems.Collection.Generic.IEnumerable`1[SMath.Manager.Term]'
My source code is listed below.
Imports SMath.Manager
Imports SMath.Math
Public Class Class1
Implements IPluginHandleEvaluation, IPluginLowLevelEvaluation
Dim termInfos() As TermInfo
Dim asseblyInfos() As AssemblyInfo
Public ReadOnly Property Dependences As SMath.Manager.AssemblyInfo() Implements SMath.Manager.IPlugin.Dependences
Get
Return Me.asseblyInfos
End Get
End Property
Public Sub Initialize() Implements SMath.Manager.IPlugin.Initialize
Me.termInfos = New TermInfo() {
New TermInfo("combin", TermType.Function, 2, "(n, k) ‐ Returns the number of subsets (combinations) of k elements that can be formed from n elements.", FunctionSection.Unknown, True)
}
Me.asseblyInfos = New AssemblyInfo() {
New AssemblyInfo("Smath Studio", New Version(0, 88), New Guid("a37cba83-b69c-4c71-9992-55ff666763bd"))
}
End Sub
Public ReadOnly Property TermsHandled As SMath.Manager.TermInfo() Implements SMath.Manager.IPluginHandleEvaluation.TermsHandled
Get
Return Me.termInfos
End Get
End Property
#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub
' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
'End Sub
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
#End Region
Public Function ExpressionEvaluation(ByVal root As SMath.Manager.Term, ByVal args()() As SMath.Manager.Term, ByRef store As SMath.Manager.Store, ByRef result() As SMath.Manager.Term) As Boolean Implements SMath.Manager.IPluginLowLevelEvaluation.ExpressionEvaluation
If root.Type = TermType.Function And root.Text = "combin" And root.ChildCount = 2 Then
Dim arg1 As Term() = Decision.Preprocessing(args(0), store)
Dim arg2 As Term() = Decision.Preprocessing(args(1), store)
Dim answer As New List(Of Term)
answer.AddRange(arg1)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg1)
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Substraction, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(New Term([Operator].Multiplication, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Division, TermType.Operator, 2))
result = answer.ToArray()
Return True
End If
Return False
End Function
End Class
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
'The following GUID is for the ID of the typelib if this project is exposed to COM
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
'
Ed
#5 Posted: 7/7/2010 2:13:51 AM
Try to change lines like:
to
AddRange function of the generic List can have only IEnumerable objects as an argument.
Regards.
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.Add(New Term([Operator].Factorial, TermType.Operator, 1))
AddRange function of the generic List can have only IEnumerable objects as an argument.
Regards.
#6 Posted: 7/8/2010 11:18:31 AM
Dear TheWizEd,
Let us know if the changes that Andrey suggested above allowed you to successfully complete the tutorial. Your feedback is appreciated.
Thanks, Will
Let us know if the changes that Andrey suggested above allowed you to successfully complete the tutorial. Your feedback is appreciated.
Thanks, Will
Will Massie
Mechanical Engineer
Oregon, USA
#7 Posted: 7/10/2010 10:05:50 AM
Sorry, I was out of town for a few days.
I changed the AddRange to Add as suggested. I should have been more careful and examined my code more closely. Any way I was successful in duplicating the example. Thanks for your patience and help.
I changed the AddRange to Add as suggested. I should have been more careful and examined my code more closely. Any way I was successful in duplicating the example. Thanks for your patience and help.

Ed
#8 Posted: 9/14/2015 5:33:57 PM
I know that this is an old thread, but all the more reason to comment on it.
The tutorial (To the best of my knowledge) is outdated. The *.dll files it told me to reference didn't exist at the specified file location: (SMath.Math.Numeric.dll vs. NuLib.dll)
Some variable names changed [to the best of my knowledge] (dim store as Store -> dim context as Store)
Also, it seems that New TermInfo() changed drastically as arugumentInfo has been implemented and the remaining arguments got moved around.
Don't get me wrong, this tutorial was still helpful (I used Visual Studio 2013) and I only had to spend a small amount of time to get a working 'plugin'.
With that being said, I received the same error that started this thread and it did not pertain to the formulas I used. Rather, Visual Studio was using a different GUID then that specified, I had to go into Assembly Info. and change the GUID there in order for the plugin to load into SMath.
I strongly urge the VB tutorial to create custom classes to be updated (Yes, I am bias to VB.net).
In addition, a tutorial showing the process of creating a custom control would be awesome (i.e. a button that refreshes the page on click, equivalent to pressing [F9])
The tutorial (To the best of my knowledge) is outdated. The *.dll files it told me to reference didn't exist at the specified file location: (SMath.Math.Numeric.dll vs. NuLib.dll)
Some variable names changed [to the best of my knowledge] (dim store as Store -> dim context as Store)
Also, it seems that New TermInfo() changed drastically as arugumentInfo has been implemented and the remaining arguments got moved around.
Don't get me wrong, this tutorial was still helpful (I used Visual Studio 2013) and I only had to spend a small amount of time to get a working 'plugin'.
With that being said, I received the same error that started this thread and it did not pertain to the formulas I used. Rather, Visual Studio was using a different GUID then that specified, I had to go into Assembly Info. and change the GUID there in order for the plugin to load into SMath.
I strongly urge the VB tutorial to create custom classes to be updated (Yes, I am bias to VB.net).
In addition, a tutorial showing the process of creating a custom control would be awesome (i.e. a button that refreshes the page on click, equivalent to pressing [F9])
#9 Posted: 9/15/2015 7:23:50 PM
WroteThe tutorial (To the best of my knowledge) is outdated. The *.dll files it told me to reference didn't exist at the specified file location: (SMath.Math.Numeric.dll vs. NuLib.dll)
Attached the updated sources (with some comments) both in C# and VB.NET
WroteIn addition, a tutorial showing the process of creating a custom control would be awesome (i.e. a button that refreshes the page on click, equivalent to pressing [F9])
To start you can look at the CheckBoxRegion in the SVN, it is simple and complete (mouse click swap the output value 1/0); working with VB.NET you need only a converter in the IDE (in Visual Studio 2013 was possible using the extensions) or to use a tool to convert the project from C# to VB.NET
Tutorials.zip (356 KiB) downloaded 38 time(s).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 Pages (9 items)
-
New Posts
-
No New Posts