(E0) Internal Error System.ArgumentNullExceptoin:Value cannot be Null 11.0.0.2807

This method throws an E0 Error (screen cap at bottom):

method ucPriceManager.mnItem_Click(Sender: Object; e: EventArgs);
begin
Case (Sender as Menu).SelectedValue of
‘prices’:
begin
hideAll;
lbPanelTitle.Text:=‘Price Manager’;
pnHealthStats.Visible:=true;
end;
‘weapons’:;
‘shist’:
begin
hideAll;
lbPanelTitle.Text:=‘Sales History’;
pnSalesHistory.Visible:=true;
loadSalesHistory;
end;
‘trans’:
begin
hideAll;
pnTranslator.Visible:=true;
lbPanelTitle.Text:=‘Translations’;
ucTranslateIt.translateItem(hfMainId.Value);
end;
‘bundle’:
begin
hideAll;
pnBundlifier.Visible:=true;
lbPanelTitle.Text:=‘Bundles’;
ucBundles.goEditBundle(hfMainId.Value,‘FBA’,‘!’);
ucBundles.deStyle;
end;
‘comp’:
begin
hideAll;
pnCompetition.Visible:=true;
lbPanelTitle.Text:=‘Competitors’;
ucCompetition.showAnalysis(hfChannelId.Value, hfMarketplace.Value);
end;
‘dets’:
begin
btCosts_Click(nil,nil);
end;
‘snotes’:
begin
hideAll;
lbPanelTitle.Text:=‘Inbound/Outbound Notes’;
pnNotes.Visible:=true;
goSnotes(hfMainId.Value);
end;
‘phist’:
begin
btComInfo_Click(nil,nil);
end;
hfBaseMenuValue1.Value, hfBaseMenuValue2.Value:
begin
// baseMenuValueSelected:=(Sender as Menu).SelectedValue;
// clearBaseMenu;
end;
end;
end;

where hfBaseMenuValue1.Value, hfBaseMenuValue2.Value are hiddenfields and baseMenuValueSelected is a public string variable monitored by the parent usercontrol.

I’ve seen an error report of this same error but now I can’t find it, it was reported as fixed likely had a different cause. V 8.2.89.1899 did not throw this error.

1st attempt at work around by var two strings and transferring the values of the hiddenfields to the string vars and using the string vars as cases instead of the hiddenfields directly. This compiles but the menu does not work. Verified all strings have the proper value:

method ucPriceManager.mnItem_Click(Sender: Object; e: EventArgs);
var Mv1, Mv2:String;

begin
Mv1:=hfBaseMenuValue1.Value;
Mv2:=hfBaseMenuValue2.Value;

Case (Sender as Menu).SelectedValue of
‘prices’:
begin
hideAll;
lbPanelTitle.Text:=‘Price Manager’;
pnHealthStats.Visible:=true;
end;
‘weapons’:;
‘shist’:
begin
hideAll;
lbPanelTitle.Text:=‘Sales History’;
pnSalesHistory.Visible:=true;
loadSalesHistory;
end;
‘trans’:
begin
hideAll;
pnTranslator.Visible:=true;
lbPanelTitle.Text:=‘Translations’;
ucTranslateIt.translateItem(hfMainId.Value);
end;
‘bundle’:
begin
hideAll;
pnBundlifier.Visible:=true;
lbPanelTitle.Text:=‘Bundles’;
ucBundles.goEditBundle(hfMainId.Value,‘FBA’,‘!’);
ucBundles.deStyle;
end;
‘comp’:
begin
hideAll;
pnCompetition.Visible:=true;
lbPanelTitle.Text:=‘Competitors’;
ucCompetition.showAnalysis(hfChannelId.Value, hfMarketplace.Value);
end;
‘dets’:
begin
btCosts_Click(nil,nil);
end;
‘snotes’:
begin
hideAll;
lbPanelTitle.Text:=‘Inbound/Outbound Notes’;
pnNotes.Visible:=true;
goSnotes(hfMainId.Value);
end;
‘phist’:
begin
btComInfo_Click(nil,nil);
end;
Mv1,Mv2:
begin
baseMenuValueSelected:=(Sender as Menu).SelectedValue;
clearBaseMenu;
end;
end;
end;

Divide the two cases into two case statement, same result compiles but again whole menu does not work:

Mv1:
  begin
  baseMenuValueSelected:=(Sender as Menu).SelectedValue; 
  clearBaseMenu; 
  end;
Mv2:
  begin
  baseMenuValueSelected:=(Sender as Menu).SelectedValue; 
  clearBaseMenu; 
  end;
end;

Simplified it as much as possible within the case statement, same thing, compiles but does not work.

Mv1:
begin
baseMenuValueSelected:=Mv1;
clearBaseMenu;
end;
Mv2:
begin
baseMenuValueSelected:=Mv2;
clearBaseMenu;
end;
end;

Transferred menu selected value into a variable, same result until I remove the cases with MV1 and MV2:

var Mv1, Mv2, Sv:String;

begin
Mv1:=hfBaseMenuValue1.Value;

Successfully compiling and functioning work around, verbose for clarity:

var Mv1, Mv2, Sv:String;

begin
Mv1:=hfBaseMenuValue1.Value;
Mv2:=hfBaseMenuValue2.Value;
Sv:=(Sender as Menu).SelectedValue;
if Sv=Mv1 then
begin
baseMenuValueSelected:=Mv1;
clearBaseMenu;
end
else if Sv=Mv2 then
begin
baseMenuValueSelected:=Mv2;
clearBaseMenu;
end
else Case Sv of
‘prices’:
begin
hideAll;
Mv2:=hfBaseMenuValue2.Value;
Sv:=(Sender as Menu).SelectedValue;

Case Sv of
‘prices’:
begin

Removed MV1 and MV2 cases.

Conclusion : Case statement hates string variable cases and becomes suicidal when those are hiddenfield.values.

Screen cap of original error: