I changed the SelectedPerson:ID to SelectedPerson.ID and the problem went away. But it only works because I know in the current case that SelectedPerson is not null. I will change my code to just check for null instead of using the “:” syntax. I’ve used that syntax a lot through the code. Don’t know what is different about this one.
Although it might be because it is a partial class. Don’t think I did “:” any place on other partial classes. Not sure, but thought that information might help you.
… time passes …
I changed the StoreID method to be a method of the class and that didn’t change the failure. Now I have this code which still fails:
procedure EditObservationViewModel.SaveUserSettingsToUseForNextObservation;
var
UserSettings : System.IO.IsolatedStorage.IsolatedStorageSettings;
begin
try
UserSettings := GetUserSettings;
if UserSettings = nil then exit;
//StoreID( Categories.SelectedCategory1:ID, 'Category1ID' );
//StoreID( Categories.SelectedCategory2:ID, 'Category2ID' );
//StoreID( Categories.SelectedCategory3:ID, 'Category3ID' );
//
//StoreID( Categories.SelectedSubCategory1:ID, 'SubCategory1ID' );
//StoreID( Categories.SelectedSubCategory2:ID, 'SubCategory2ID' );
//StoreID( Categories.SelectedSubCategory3:ID, 'SubCategory3ID' );
var x := SelectedPerson:id;
StoreID( UserSettings, x, 'ObserverID' );
UserSettings.Save;
except
on E : IsolatedStorageException do begin
ShowIsolatedStorageException( e.Message );
end;
on e: Exception do raise;
end;
end;
When I look at this in Reflector, I see:
method EditObservationViewModel.SaveUserSettingsToUseForNextObservation;
begin
// This item is obfuscated and can not be translated.
try
var UserSettings: IsolatedStorageSettings := self.GetUserSettings;
if (UserSettings <> nil) then begin
var selectedPerson: PersonBase := self.SelectedPerson;
if (selectedPerson <> nil) then
{pseudo} goto Label_001F;
var iD: &Nullable<Guid> := selectedPerson.ID;
var x: &Nullable<Guid> := nil;
self.StoreID(UserSettings, x, 'ObserverID');
UserSettings.Save
end
except
on E: IsolatedStorageException do
self.ShowIsolatedStorageException(E.Message);
on e: Exception do
raise new Exception
end
end;
In case that helps you.
Not sure why the generated code sets iD to something when it isn’t used anywhere since a simple nil is going to passed into the routine as x. But I suppose the Label_001F is the part that was “destabilizing” the runtime.
And my compiler version is OLD. Here is all the version information, in case that helps you:
Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework
Version 4.0.30319 SP1Rel
Installed Version: Professional
Microsoft Office Developer Tools 01018-532-2002102-70042
Microsoft Office Developer Tools
Microsoft Visual Basic 2010 01018-532-2002102-70042
Microsoft Visual Basic 2010
Microsoft Visual C# 2010 01018-532-2002102-70042
Microsoft Visual C# 2010
Microsoft Visual C++ 2010 01018-532-2002102-70042
Microsoft Visual C++ 2010
Microsoft Visual F# 2010 01018-532-2002102-70042
Microsoft Visual F# 2010
Microsoft Visual Studio 2010 Team Explorer 01018-532-2002102-70042
Microsoft Visual Studio 2010 Team Explorer
Microsoft Visual Web Developer 2010 01018-532-2002102-70042
Microsoft Visual Web Developer 2010
Critical Update for Microsoft Visual Studio 2010 Professional - ENU (KB2938807) KB2938807
This critical update is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this critical update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2938807.
Crystal Reports Templates for Microsoft Visual Studio 2010
Crystal Reports Templates for Microsoft Visual Studio 2010
Embarcadero Delphi Prism 4.0.27.843
Embarcadero Delphi Prism
Powered by the RemObjects Oxygene Compiler
Copyright © 2008-2010 Embarcadero Technologies, Inc. All rights reserved.
All Embarcadero brand and product names are trademarks or registered trademarks of Embarcadero Technologies, Inc. in the United States and other countries. Oxygene is a trademark of RemObjects Software, LLC in the United States and other countries. All other marks are the property of their respective owners.
Dedicated to Rick Wright (1943-2008).
Enjoy the Great Gig in the Sky.
Entity Framework 4.1 Power Tools 1.0
Adds useful design-time DbContext features to the Visual Studio Solution Explorer context menu.
When right-clicking on a file containing a derived DbContext class, the following context menu functions are supported:
1) View Entity Data Model - Displays the underlying Code First model in the Entity Framework designer.
2) View Entity Data Model XML - Displays the EDMX XML representing the underlying Code First model.
3) Optimize Entity Data Model - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project.
Git Source Control Provider 1.0.0.0
Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2529927) KB2529927
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2529927.
Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2548139) KB2548139
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2548139.
Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2549864) KB2549864
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2549864.
Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2565057) KB2565057
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2565057.
Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2635973) KB2635973
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2635973.
Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2736182) KB2736182
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2736182.
Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2890573) KB2890573
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2890573.
Microsoft Visual Studio 2010 Professional - ENU Service Pack 1 (KB983509) KB983509
This service pack is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/983509.
Microsoft Visual Studio 2010 SharePoint Developer Tools 10.0.40219
Microsoft Visual Studio 2010 SharePoint Developer Tools
NuGet Package Manager 1.4.20615.9020
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Oracle Developer Tools for Visual Studio 11.2.0.1.2
Oracle Developer Tools for Visual Studio Copyright (c) 2005, 2010
RemObjects Everwood 3.0.17.257
RemObjects Everwood for .NET
Copyright 2003-2010 RemObjects Software, LLC. All rights reserved.
http://www.remobjects.com/everwood
RemObjects Oxygene 4.0.27.843
RemObjects Oxygene
Copyright 2003-2011 RemObjects Software, LLC. All rights reserved.
http://www.remobjects.com/oxygene
Security Update for Microsoft Visual Studio 2010 Professional - ENU (KB2645410) KB2645410
This security update is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this security update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2645410.
SQL Server Data Tools 10.3.20905.0
Microsoft SQL Server Data Tools
VisualStudioIntegration2010 1.0
Information about my package
Git Extensions
Git Extensions is a graphical interface for Git
For more information about Git Extensions, see the Git Extensions website at
http://code.google.com/p/gitextensions/
Copyright © 2012 Henk Westhuis