"Cannot create an abstract class" error in VS2019
Author: halbustami
Creation Date: 3/23/2020 4:53 AM
profile picture

halbustami

#1
Hey all,

I'm new here and just began using Wealth Lab. I've been using Visual studio for years and when I came across the link showing how to use Visual studio; I followed the instructions. Anyway, documentation says to target 4.5 but the latest DLL from wealth lab that I referenced targeted 4.6.2. so that's the only change I made. Apologies if this post is a repeat but I did search the forum and couldn't find anything to help .I have come across the error shown below. I'm using Visual Studio 2019 Enterprise edition. What could possibly cause this error?

So as can be seen,
CODE:
Please log in to see this code.
is trying to create an instance of something it is not supposed to do

************* Exception Text **************
System.MissingMethodException: Cannot create an abstract class.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Fidelity.Components.AssemblyLoader.CreateInstance(Type t)
at WealthLab.StrategyManager.GetWealthScriptObject(Strategy s)
at WealthLabPro.ChartForm.set_Strategy(Strategy value)
at WealthLabPro.MainForm.OpenStrategyWindow(Strategy s, Boolean executeOnSelectedSymbol, Boolean useAdvancedSettings)
at WealthLabPro.MainForm.OpenStrategyWindow(Strategy s, Boolean executeOnSelectedSymbol)
at WealthLabPro.MainForm.OpenStrategyWindow(Strategy s)
at WealthLabPro.MainForm.OpenStrategyExplorer()
at WealthLabPro.MainForm.b0(Object A_0, EventArgs A_1)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Just for the record I implemented the strategy helper as shown below

CODE:
Please log in to see this code.


and the class inhering from Wealth script:
CODE:
Please log in to see this code.


Help is greatly appreciated and thank you for your time and patience as I start learning this.
profile picture

Eugene

#2
Hi Haytham,

Welcome to the forums. Are we supposed to guess what type of addin are you trying to compile (okay, most likely it's WealthScript Strategy) and what is the code? Please post it here and I'm sure we'll get to the bottom of it.
profile picture

halbustami

#3
Hello, there is really no script yet. I just added a simple method called "ClearExternalSymbols();" I have edited the post and not sure if you replied before seeing it or after.

Thank you.
profile picture

superticker

#4
Could you show us how Strategy1 calls or references Strategy1Helper? In my mind, they seem unrelated ... or am I missing something?
profile picture

Eugene

#5
Haytham, here is the error:
CODE:
Please log in to see this code.

And given that your class name is "Strategy1", the fix is simple:
CODE:
Please log in to see this code.
profile picture

halbustami

#6
Help very well appreciated. I always do this when I start with new things, match names with classes and end up referencing the wrong type.
profile picture

Eugene

#7
You're welcome.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).