I found tTwo other un-resolved cases of the same thing happening - see details here:
https://www.devexpress.com/Support/Center/Question/Details/Q459035
https://www.devexpress.com/Support/Center/Question/Details/T147036
My case is the same…
Very large project - has been working fine previously.
Just went to edit (add to) the images in a DevExpress.Utils.ImageCollection on a UserControl and got the same error, after freezing Visual Studio for about 2 minutes.
---------------------------
Microsoft Visual Studio
---------------------------
Operation is not valid due to the current state of the object.
---------------------------
OK
---------------------------
Attempted to replicate by creating a test project - but couldn't replicate.
The problem is when clicking on "Load from Project Resources" on the Add button in the "ImageInfo Collection Editor"
When adding a new UserControl (WinForms .net 4.5 - C#) to the existing project - dropping an ImageCollection on it - and attempting to "Load from Project Resources" - problem still occurs, so it is a project wide problem.
further to this - I decided to test with a new simple test project - but the resources from out main project.
I created a new winforms project, and then copied from out main project the Resources.resx and the Resources Directory.
I then put a System.Windows.Forms.PictureBox and a DevExpress.Utils.ImageCollection on that form.
- and rebuilt / compiled.
So using the Properties editor in VS2012 - I opened up the "Select Resource" dialog for the Image property of the Picture box.
It correctly displayed all my resources, and allowed selection one correctly.
However - attempting to add an image from resources for the DevExpress.Utils.ImageCollection - I now have the "Select Resources" dialog come up - but it is empty - and says down the bottom "No resources were found".
This is obviously a bug somewhere - slightly different to the one I was trying to replicate, but probably related!
ok - further testing - In the test project - I removed all non-image resources from Resources.resx - and now the ImageCollection is showing all the image resources…
Hi,
I have reproduced the second issue and passed it to our developers within the scope of a new ImageCollection - Images from project resources are not shown if these resources contain files of other formats thread. We will update this thread once we have results.
As for the main issue, please try isolating it to a simpler project and send it to us for investigation. In this case, we will be able to determine why the issue occurs.
I look forward to your response.
So - to rule out any environment issues - I built a bare-bones new vm - installed only what was required to build main project - pulled the latest code source control (mercurial on kiln) - compiled ok.
But - still get the "Operation is not valid due to the current state of the object." when attempt to "Load from Project Resources" on the Add button in the "ImageInfo Collection Editor"
So - the problem is not environment / addins / etc…
Must be specific project related.
ok - so - I then included into my test project, all 150+ resx files from the main project (along with their resources) - compiled - and still didn't get the error in the test project.
So - can rule out an issue with the actual resources…
Hello Gerard,
It's still difficult to determine the cause of the exception based only on your description.
The MessageBox with the "Operation is not valid due to the current state of the object." message is shown because of the exception thrown in VS.
Would you please provide me with the exception call stack? It will allow me to find a precise solution for you.
Refer to the KA18588: Collecting a call stack to track down the cause of VS crash or freeze issues KB article for details on how to get the required exception call stack.
I'm looking forward to your response.
attempting to collect a stack trace - while attached - I keep getting prompted for the source of "ProjectResourceHelpers.cs"
I'm assuming this is because I've previously loaded the DevExpress source code and debug symbols in the past?
So - Basically - I'm not managing to get the stack trace you're after - as that is causing a NotImplementedExcpetion instead.
ARGHH - I had to kill the vs process after taht - and now when re-starting vs - I get
---------------------------
Microsoft Visual Studio
---------------------------
The Add-in 'VMDebugger' failed to load or caused an exception.
Would you like to remove this Add-in?
If you choose yes, you will need to reinstall the Add-in to use it again.
Error Message: Unspecified error
Error number: 80004005
---------------------------
Yes No
---------------------------
Ok - managed to get this out after turning off debug symbols (and some other things)
Not sure what version of Visual Studio KA18588 is for - but some of the options weren't there - or different. Perhaps that article could indicate the version used?
Anyway…
> Microsoft.VisualStudio.CSharp.Services.Language.dll!Microsoft.VisualStudio.CSharp.Services.Language.BaseException.ThrowENOTIMPL() + 0x1d bytes
Microsoft.VisualStudio.CSharp.Services.Language.dll!Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CodeModelProjectCache.FindOrCreateItem(Microsoft.RestrictedUsage.CSharp.Core.FileName fileName, object parent) + 0x263 bytes
Microsoft.VisualStudio.CSharp.Services.Language.dll!Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CodeModelFactory.Microsoft.VisualStudio.CSharp.Services.Language.Interop.ICodeModelFactory.CreateFileCodeModel(Microsoft.VisualStudio.CSharp.Services.Language.Interop.ILangService languageService, object parent, Microsoft.VisualStudio.CSharp.Services.Language.Interop.IProject project, string fileName) + 0x70 bytes
[Native to Managed Transition]
[Managed to Native Transition]
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectResearcherBase.GetFileCodeModel(EnvDTE.ProjectItem item) + 0x21 bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectResearcherBase.ProcessProjectItem(EnvDTE.ProjectItem item = COM Object, object data = null) + 0x13 bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectResearcherBase.RefreshCore(EnvDTE.ProjectItems items, object data = null) + 0x6f bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectResearcherBase.RefreshCore(EnvDTE.ProjectItems items, object data = null) + 0x62 bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectResearcherBase.RefreshCore(EnvDTE.ProjectItems items, object data = null) + 0x62 bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectResearcherBase.Refresh(object data = null) + 0x1f bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectImageResourceResearcher.Refresh(object data) + 0x1d bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectImagePicker.ProjectImageSelectionForm.InitResourceFileList() + 0x6d bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ProjectImagePicker.ProjectImageSelectionForm.ProjectImageSelectionForm(DevExpress.Utils.Design.ProjectImagePicker.IProjectImagePickerOwner owner) + 0xd1 bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ImageCollectionProjectImageInfoCreator.CreateForm(bool addOnly, DevExpress.Utils.Design.ProjectImagePicker.IProjectImagePickerOwner owner) + 0x3f bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ImageCollectionProjectImageInfoCreator.Create(bool addOnly) + 0x79 bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ImageCollectionAction.EditImages(DevExpress.Utils.ImageCollection col = {DevExpress.Utils.ImageCollection}, System.ComponentModel.IComponent component = {DevExpress.Utils.ImageCollection}, System.IServiceProvider serviceProvider, System.Type itemType = {Name = "ProjectImageInfo" FullName = "DevExpress.Utils.ProjectImageInfo"}, bool preserveSelected = false) + 0x7e bytes
DevExpress.Design.v15.1.dll!DevExpress.Utils.Design.ImageCollectionActionList.OnLoadFromProjectResources() + 0x29 bytes
[Native to Managed Transition]
System.Design.dll!System.ComponentModel.Design.DesignerActionMethodItem.Invoke() + 0x59 bytes
System.Design.dll!System.ComponentModel.Design.DesignerActionPanel.MethodLine.OnLinkLabelLinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) + 0x37 bytes
System.Windows.Forms.dll!System.Windows.Forms.LinkLabel.OnLinkClicked(System.Windows.Forms.LinkLabelLinkClickedEventArgs e) + 0x5d bytes
System.Windows.Forms.dll!System.Windows.Forms.LinkLabel.OnMouseUp(System.Windows.Forms.MouseEventArgs e = {X = 50 Y = 10 Button = Left}) + 0x181 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0x274 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x892 bytes
System.Windows.Forms.dll!System.Windows.Forms.Label.WndProc(ref System.Windows.Forms.Message m) + 0x34 bytes
System.Windows.Forms.dll!System.Windows.Forms.LinkLabel.WndProc(ref System.Windows.Forms.Message msg) + 0x17 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x11 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x39 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x5e bytes
…and if I leave it until I get the error as originally reported - the only stack trace is:
> Microsoft.VisualStudio.dll!Microsoft.VisualStudio.UIService.System.Windows.Forms.Design.IUIService.ShowError(string message) + 0x5c bytes
System.Design.dll!System.ComponentModel.Design.DesignerActionPanel.ShowError(string errorMessage) + 0x3e bytes
System.Design.dll!System.ComponentModel.Design.DesignerActionPanel.MethodLine.OnLinkLabelLinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) + 0xda bytes
System.Windows.Forms.dll!System.Windows.Forms.LinkLabel.OnLinkClicked(System.Windows.Forms.LinkLabelLinkClickedEventArgs e) + 0x5d bytes
System.Windows.Forms.dll!System.Windows.Forms.LinkLabel.OnMouseUp(System.Windows.Forms.MouseEventArgs e = {X = 30 Y = 8 Button = Left}) + 0x181 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0x274 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x892 bytes
System.Windows.Forms.dll!System.Windows.Forms.Label.WndProc(ref System.Windows.Forms.Message m) + 0x34 bytes
System.Windows.Forms.dll!System.Windows.Forms.LinkLabel.WndProc(ref System.Windows.Forms.Message msg) + 0x17 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x11 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x39 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x5e bytes