chef 3745 Posted February 27, 2016 Share Posted February 27, 2016 (edited) Okay, I have to ask now because I have narrowed it down to two possibilities, and I don't know whats going on:I get this stack trace error when attempting to navigate to an embedded HTML page in my plugin. Response Status Error CodeInvalidOperationExceptionMessageSequence contains no matching elementStack Trace[GetDashboardConfigurationPage: 2/27/2016 1:48:44 PM]: [REQUEST: {}] System.InvalidOperationException: Sequence contains no matching element at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate) at MediaBrowser.WebDashboard.Api.DashboardService.Get(GetDashboardConfigurationPage request) at ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto)Errors It would seem that this is happening when I attempt to update my Configuration XML file before moving to another HTML Doc.The configuration XML does update, so it leads me to believe there is an issue with how I am navigating to my embedded HTML page...Here is the button click which is causing the error. I wouldn't ask if I really could figure out what was going on (I know the code isn't the prettiest...sorry)... $('#saveButton2').on('click', function () { Dashboard.showLoadingMsg(); var newDevice = { Name: tempConfig.DeviceConfiguration.Name, Id: tempConfig.DeviceConfiguration.Id, MoviesPlaybackStarted: $('#MoviesPlaybackStarted option:selected').val(), MoviesPlaybackPaused: $('#MoviesPlaybackPaused option:selected').val(), MoviesPlaybackStopped: $('#MoviesPlaybackStopped option:selected').val(), MoviesPlaybackUnpaused: $('#MoviesPlaybackUnPaused option:selected').val(), SeriesPlaybackStarted: $('#SeriesPlaybackStarted option:selected').val(), SeriesPlaybackPaused: $('#SeriesPlaybackPaused option:selected').val(), SeriesPlaybackStopped: $('#SeriesPlaybackStopped option:selected').val(), SeriesPlaybackUnpaused: $('#SeriesPlaybackUnPaused option:selected').val(), MusicPlaybackStarted: $('#MusicPlaybackStarted option:selected').val(), MusicPlaybackPaused: $('#MusicPlaybackPaused option:selected').val(), MusicPlaybackStopped: $('#MusicPlaybackStopped option:selected').val(), MusicPlaybackUnpaused: $('#MusicPlaybackUnPaused option:selected').val(), SessionStarted: $('#SessionStarted option:selected').val(), SessionEnded: $('#SessionEnded option:selected').val(), SceneSchedule: $('#ScheduleTime').val() } var device = []; // Here are all the potential saved Profiles we have already, // we want rewrite them all except the one we are currently editing (if it exists). var pushedDevice; if (tempConfig.SavedDeviceProfiles) { tempConfig.SavedDeviceProfiles.forEach(function (c) { if (c.Name != tempConfig.DeviceConfiguration.Name) { pushedDevice = { Name: c.DeviceName, Id: c.DeviceId, MoviesPlaybackStarted: c.MoviesPlaybackStarted, MoviesPlaybackStopped: c.MoviesPlaybackStopped, MoviesPlaybackPaused: c.MoviesPlaybackPaused, MoviesPlaybackUnpaused: c.MoviesPlaybackUnpaused, SeriesPlaybackStarted: c.SeriesPlaybackStarted, SeriesPlaybackStopped: c.SeriesPlaybackStopped, SeriesPlaybackPaused: c.SeriesPlaybackPaused, SeriesPlaybackUnpaused: c.SeriesPlaybackUnpaused, MusicPlaybackStarted: c.MusicPlaybackStarted, MusicPlaybackStopped: c.MusicPlaybackStopped, MusicPlaybackPaused: c.MusicPlaybackPaused, MusicPlaybackUnpaused: c.MusicPlaybackUnpaused, SessionEnded: c.SessionEnded, SessionStarted: c.SessionStarted, SceneSchedule: c.SceneSchedule } device.push(pushedDevice); } }); device.push(newDevice); } // Empty these properties, until we need them next time we open the client config page var currentClientConfig = { Name: null, Id : null }; var newConfig = { SavedDeviceProfiles : device, DeviceConfiguration : currentClientConfig } ApiClient.updatePluginConfiguration(pluginId, newConfig).then(function () { }); var url = Dashboard.getConfigurationPageUrl("MiOsConfigurationPage"); $(window.location).attr('href', url); }); Some help for one of our more seasoned devs would be much appreciated.Thank you.Ben Edited February 27, 2016 by chef Link to comment Share on other sites More sharing options...
chef 3745 Posted February 27, 2016 Author Share Posted February 27, 2016 (edited) After looking at this code longer, it could be the fact that it is declaring "pushedDevices" outside the condition which asked if there are any "savedDeviceProfiles"...It might be causing an error if there are none and trying to push an empty property list... Edit: Nope... the code works up to when I request "Dashboard.getConfigurationPageUrl". It could be in my CS IPluginConfigurationPage code...Hmm Edited February 27, 2016 by chef Link to comment Share on other sites More sharing options...
chef 3745 Posted February 27, 2016 Author Share Posted February 27, 2016 I have no idea how I fixed this but it is working now. Link to comment Share on other sites More sharing options...
chef 3745 Posted February 27, 2016 Author Share Posted February 27, 2016 I know why this was broken! I changed my configuration Class in CS to have "Name" and "ID" Properties. These Properties used to be called "DeviceName", and "DeviceId". So when I attempted to have the HTML configuration write back to the XML file without changing then property names, it could not find it and an error was thrown. SO in case anyone every decides to refactor code, or translate code into another language. REMEMBER to go through thoroughly and make sure that Property names are equal. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now