Shared or local block on a page type?
At the moment it's happening when a shared block, I've not tested with a local block. The block in question is actually a FormContainerBlock inherited from the EPiServer so that I can add additional properties to the Form.
Isn't this a standard .NET message that can happen when you debug release built assemblies? Like mentioned here: http://stackoverflow.com/questions/8311303/cannot-obtain-value-of-local-or-argument-as-it-is-not-available-at-this-instruct
I had seen that article and tried all the suggestions it contained and all my VS settings were and are as recommended. The issue is happening in a Bll component project so the code optimization scenario seems a valid cause. It was actually working yesterday and I thought it was caused by the naming of the variable but then it stopped working again today. Frustrating...
Clear temporary files and rebuild?
I've already tried that and it made no difference. It must be a VS debug issue, if I run the code without debugging it does not error. Makes it difficult if I need to debug though...
Yup. Add some logging with log4net if you need I guess :)
Sounds like you are running in release mode from the error...
I have weird IContentLoader error and wondered if anyone can shed any light on what's causing it.
I have the code:
var loader = ServiceLocator.Current.GetInstance
var contentBlock = loader.Get
if (contentBlock != null)
var test = contentBlock.SomeProperty;
And the contentBlock is not null but when trying to access the property it throws a massive error.
When I check contentBlock in the immediate window I get the message "Cannot obtain value of local or argument 'contentBlock' as it is not available at this instruction pointer, possibly because it has been optimized away."
But if I do something like var contentBlock1 = loader.Get
(Guid); in the immediate window then I get the block returned as expected.
Any thoughts on what's happening here?