You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was following an example from NAppUpdate blog (which I now know is not only outdated but erroneous, see: http://pastebin.com/198EtE6B).
In it CheckForUpdates is passed IUpdateSource but unless set globally ahead of the time, it will cause the PrepareUpdates to fail.
So this does not work:
// prep
var updateManager = UpdateManager.Instance;
// more checks
updateManager.CheckForUpdates(updateSource); // passed in via method arg
// other stuff...
updateManager.PrepareUpdates(); // <-- NPE
But this does
// prep
var updateManager = UpdateManager.Instance;
updateManager.UpdateSource = updateSource; // must set it here !!!
// more checks
updateManager.CheckForUpdates(updateSource);
// other stuff...
updateManager.PrepareUpdates(); // <-- now it works....
Suggested fix:
in UpdateManager.cs inside of public void CheckForUpdates(IUpdateSource source) method after checking the args re-set UpdateSource to (maybe line 247)
UpdateSource = source;
so that subseqent call to Prepare does not fail...
Perhaps even better, do not allow methods to accept update source at all, and have checks in all methods to insure it is set before invoking them (unless there is a need to have varying update sources during update process ?)....
The text was updated successfully, but these errors were encountered:
Hi
I was following an example from NAppUpdate blog (which I now know is not only outdated but erroneous, see: http://pastebin.com/198EtE6B).
In it CheckForUpdates is passed IUpdateSource but unless set globally ahead of the time, it will cause the PrepareUpdates to fail.
So this does not work:
But this does
Suggested fix:
in UpdateManager.cs inside of public void CheckForUpdates(IUpdateSource source) method after checking the args re-set UpdateSource to (maybe line 247)
so that subseqent call to Prepare does not fail...
Perhaps even better, do not allow methods to accept update source at all, and have checks in all methods to insure it is set before invoking them (unless there is a need to have varying update sources during update process ?)....
The text was updated successfully, but these errors were encountered: