ExternalSymbol indicator: Runtime error "Unable to load one or more of the requested types"
Author: superticker
Creation Date: 12/25/2017 7:39 PM
profile picture

superticker

#1
Wealth Lab has be working for two years when suddenly I'm getting this run-time error message (see load requested type failure attachment) about it not being able to load a requested type. Doing some debugging, the request type is the ExternalSymbol "indicator" in the Community.Indicators.DLL library.

I updated this library, but that didn't help. I tried using other indicators in the library, and they all work just fine except ExternalSymbol. I tried dragging the ExternalSymbol indicator onto a plain Chart, but it won't render an external symbol. After replying to its dialog box, it just does nothing--not even an error message.

I appreciate this is not a coding problem. Maybe it's a manifest problem with the Community.Indicators.DLL, but VS Object Explorer doesn't think so, at least not within the Project. I can't speak for the assembly.

I'm thinking it has something to do with the application state variables WL sets and saves. So the load requested type failure files attachment shows all the internal files that have changed since the problem started. Which file is it, and which state variable do I need to tweak so WL can load and use the ExternalSymbol indicator again?

Also, why is the ExternalSymbol indicator "special" when all the other indicators in the library work just fine? And why has ExternalSymbol been working for two years until now? I just don't get it.
profile picture

Eugene

#2
QUOTE:
I tried dragging the ExternalSymbol indicator onto a plain Chart, but it won't render an external symbol.

1. My guess is that its settings saved in WealthLabConfig.txt might be corrupt. I'd advise to close WLP, move out the WealthLabConfig.txt file and restart WLP.

2. If this won't help, it may be related to your own coding as you're using custom built indicator and class libraries. Whatever you're doing in your code, you have to account for ExternalSymbol's nature and adjust your code accordingly.

QUOTE:
Also, why is the ExternalSymbol indicator "special" when all the other indicators in the library work just fine?

ExternalSymbol is the special case among all other indicators since it uses System.Reflection to do its thing.

profile picture

superticker

#3
Something really weird is going on. I renamed WealthLabConfig.txt, but that didn't help. Now every strategy terminates with an error message. See below. I removed all my own libraries; that didn't help. I reinstated the old WealthLabConfig.txt; that didn't help. I put everything back the way it originally was; that didn't help. If I try to continue from the unhandled exception, WL quits; but that's expected.

What I can do is open a Chart window and display any stocks. But if a try to open any strategy (canned or my own), even via a simply Chart window, I get the following unhandled exception. What's happening?

CODE:
Please log in to see this code.
profile picture

Eugene

#4
This happens sometimes after reinstallation or upon deleting WealthLabConfig.txt - especially when you customized the Editor. Please refer to this KB article:

Errors | Strategy > Strategy editor does not function > ArgumentOutOfRangeException

There are 4 workarounds and one of them should work out. Give them a try and WLP will be up and running in minutes.

P.S. Afterwards make sure that WealthLabConfig.txt has no traces of "ExternalSymbol."
profile picture

superticker

#5
Thanks a bunch. That fixed the editor problem. Cool.

Now tell me if you get the original run-time error discussed in post# 1 when executing this code below. If you're not getting it, then why would I be? Is there something wrong with my WL configuration that changed from Saturday to today (Monday)?

BTW, this ExternalSymbol call has been working flawlessly for two years until today, so I don't think it's the code itself. Last night I used the Squeeze() indicator for the first time in Community.Indicators.DLL. But I can't imagine how doing so would affect that assembly loading for ExternalSymbol. This can't be right.

CODE:
Please log in to see this code.
profile picture

superticker

#6
I got it working. Here's what I did.

1) I went into the administrator account to run WL, which I typically only do to run Extension Manager for getting library updates from the WL website. To my surprise, the problem persisted. How could that be on a whole different Windows account?

2) I'm running WL 6.9.19.0. Realizing many of my WL extension libraries were from the .NET framework 4.5.X days. And realizing how Visual Studio absolutely refused to build my own Superticker.Components.dll and Superticker.Indicators.dll libraries for WL 6.9.19.0 until I upgraded VS to .NET framework 4.6.2 (Why is Visual Studio so particular?), I went ahead and upgraded all my libraries from the WL website.

I then restarted WL in the administrator account, and reran my above test program. The problem persisted.

3) Then rebooted the entire workstation, and logged into my production account. I ran the test program again and everything worked fine.

---
For the life of me, could you please tell me what happened? No other program on my system seemed affected. No other WL function seemed to be affected. And by logging in and out of Windows accounts, I was clearing the slate of process variables. So why would rebooting the machine make a difference with how the loader would behave for one specific library function? I'm baffled.

Yes, I know the Reflection implementation of the ExternalSymbol function escapes the C# language, but that's not really relevant to loader operation at the system wide level ... is it?

I might add, this workstation works very well. There are no weird problems with this machine. I would know.
profile picture

Eugene

#7
Glad that you got it working after restart.