After compute restart and open simple desktop project I found error To prevent possible data loss before loading the designer, the following errors must be resolved:
call stack:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.NativeMethods.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetFileDocData(String fileName, FileAccess access, String createTemplate, Boolean addToHostList, Boolean nestedItem)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomProvider.OnParseBegin(TextReader reader)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.Parse(TextReader codeStream)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.System.CodeDom.Compiler.ICodeParser.Parse(TextReader stream)
at System.CodeDom.Compiler.CodeDomProvider.Parse(TextReader codeStream)
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
How to fight with such errors and bring my form designer back?
You must have deleted something and You must delete it from designer. If you had done a delete operation , go to designer page and delete it from here also. Than if do you want add your control again, you can add it after this operation
Related
After I added a UserControl to my Form it suddenly started to produce this error:
Error HRESULT E_FAIL has been returned from a call to a COM component
So I googled around and found out it is somehow related to cache. So I deleted suo file from my solution. And now it produces this error:
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
I googled that too and found out I should read the contents of the ActivityLog.xml which can be found in %appdata%\Microsoft\VisualStudio. It starts with this message:
Construction of frame content failed.
I couldn't find any solution any further.
here is the complete error from that log:
Construction of frame content failed. Frame identifier:
ST:0:0:{31fc2115-5126-4a87-b2f7-77eaab65048b} Frame caption: Exception
details: System.ArgumentNullException: Parameter name: protocolHandler
at
Microsoft.XamlDiagnostics.UI.LivePropertyExplorer.Model.PropertyExplorerModel..ctor(IProtocolHandler
protocolHandler, IActiveElementTracker tracker, ITelemetryLogger
telemetryLogger) at
Microsoft.XamlDiagnostics.Model.XamlDiagnosticsTool.GetPropertyExplorerModel(IServiceProvider
serviceProvider) at
Microsoft.XamlDiagnostics.Model.XamlDiagnosticsTool.CreatePropertyExplorer(IServiceProvider
serviceProvider, ResourceDictionary themeDictionary, UIElement
searchContentControl) at
Microsoft.VisualStudio.ClientDiagnostics.XamlDiagnostics.PropertyExplorerToolWindow.GetContent()
at
Microsoft.VisualStudio.ClientDiagnostics.XamlDiagnostics.XamlDiagnosticsToolWindowBase.ShowContent()
at
Microsoft.VisualStudio.ClientDiagnostics.XamlDiagnostics.XamlDiagnosticsToolWindowBase.Initialize()
at
Microsoft.VisualStudio.Shell.WindowPane.InternalSetSite(IServiceProvider
p) at
Microsoft.VisualStudio.Shell.WindowPane.Microsoft.VisualStudio.Shell.Interop.IVsWindowPane.SetSite(IServiceProvider
psp) at
Microsoft.VisualStudio.Shell.WindowPane.Microsoft.VisualStudio.Shell.Interop.IVsUIElementPane.SetUIElementSite(IServiceProvider
p) at
Microsoft.VisualStudio.Platform.WindowManagement.UIElementDocumentObject.SetSite(DocumentObjectSite
site) at
Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.InitializeDocumentObject(Object
punkView) at
Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.CreateContentPane(FrameMoniker
frameMoniker, Boolean isDocument, String lpstrMkDoc, UInt32
eCreateWindowFlags, Object punkView, Object punkData, IServiceProvider
pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid, Guid
rguidCmdUI, ViewGroup parent, IVsWindowFrame& ppWindowFrame) at
Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.CreateContentPane(String
pszName, Int32 fDockViewOn, Int32 fDocument, String lpstrMkDoc, UInt32
eCreateWindowFlags, UInt32 dwToolWinId, Object punkView, Object
punkData, IServiceProvider pServiceProvider, IVsUIHierarchy
pUIHierarchy, UInt32 vsid, Int32& pfDefaultPosition, Guid& rguidCmdUI,
IVsWindowFrame& ppWindowFrame) at
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo) at
Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type
toolWindowType, Int32 id, UInt32 flags) at
Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type
toolWindowType, Int32 id, ProvideToolWindowAttribute tool) at
Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type
toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute
tool) at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Guid&
toolWindowType, Int32 id) at
Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsToolWindowFactory.CreateToolWindow(Guid&
toolWindowType, UInt32 id) at
Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()
What's going on? What does Construction of frame content failed mean?
Thanks to Caius I managed to find the problem. The designer was unable to render the Form because of an error regarding the UserControl. I looked into the designer.cs file and find a warning saying that there is a conflict between UserControl [version] in [path] and UserControl in [path].
I looked into the references of the project and found a self-reference there! So I removed it and the error went away.
The UserControl and Form were in the same project and while adding the UserControl to the Form I drag-and-dropped the UserControl from the Toolbox onto the Form. So it automatically added a self-reference to my project. I'm not sure why it did that. But removing the reference solved the issue.
Following issue occurs when building the project.
Output Window Details
*1>------ Rebuild All started: Project: XYZ.Droid, Configuration: Debug Any CPU ------
1>C:\Users\amila.s\Desktop\XYZ\ABC.Mobile-develop\ABC.Mobile-develop\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets(114,3): error : End of Central Directory record could not be found.
1>C:\Users\amila.s\Desktop\XYZ\ABC.Mobile-develop\ABC.Mobile-develop\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets(114,3): error : at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
1>C:\Users\amila.s\Desktop\XYZ\ABC.Mobile-develop\ABC.Mobile-develop\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets(114,3): error : at System.IO.Compression.ZipArchive.Init(Stream stream, ZipArchiveMode mode, Boolean leaveOpen)
1>C:\Users\amila.s\Desktop\XYZ\ABC.Mobile-develop\ABC.Mobile-develop\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets(114,3): error : at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
1>C:\Users\amila.s\Desktop\XYZ\ABC.Mobile-develop\ABC.Mobile-develop\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets(114,3): error : at Xamarin.Build.Download.XamarinBuildAndroidAarRestore.LoadResource(String resourceFullPath, String assemblyName)
1>C:\Users\amila.s\Desktop\XYZ\ABC.Mobile-develop\ABC.Mobile-develop\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.targets(114,3): error : at Xamarin.Build.Download.BaseXamarinBuildResourceRestore.MergeResources(IAssemblyResolver resolver, String originalAsmPath, String mergedAsmPath, String assemblyName, List`1 resourceItems)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========*
Error Window Details
Severity Code Description Project File Line Suppression State
Error End of Central Directory record could not be found. at
System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory() at
System.IO.Compression.ZipArchive.Init(Stream stream, ZipArchiveMode
mode, Boolean leaveOpen) at
System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode
mode, Boolean leaveOpen, Encoding entryNameEncoding) at
Xamarin.Build.Download.XamarinBuildAndroidAarRestore.LoadResource(String
resourceFullPath, String assemblyName) at
Xamarin.Build.Download.BaseXamarinBuildResourceRestore.MergeResources(IAssemblyResolver
resolver, String originalAsmPath, String mergedAsmPath, String
assemblyName, List`1 resourceItems) PayByCar.Droid
There are seem to be no much support regarding this issue. It would be highly appreciated if anyone could help on this. Thanks.
Just in case anyone else is getting this issue as well, (And cannot simply do like what a lot of other threads recommend, by changing the version of Xamarin.Build.Download to a previous version):
My solution was to go to C:\Users\(username)\AppData\Local and delete the Xamarin and XamarinBuildDownloadCache, then rebuild my project.
I presume that due to a faulty network connection, one or more files had been corrupted during the initial download process, which made it so that even clearing just about everything (except that directory) would not fix the issue.
When entering a view for the first time, this exception is raised:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
First of all - why would it just happen the first time I enter that specific view? Even IF the issue was in the constructor (which it could not be), it would be called (and the exception thrown) every time I enter the view.
Second of all - how would I find the source of such an exception? It doesn't break into the debugger, and there are no resource files (like background images, app bar icons) missing.
Lastly - what (except directly referencing files in the code) would throw such an exception?
I would show you the code in question, but the file is a bit too big to post all of it.
UPDATE:
After debugging, I have noticed that the error happens after the constructor and OnNavigatedTo() and before Loaded(). There is a thread being launched in the OnNavigatedTo method, but I have tried to try-catch every single element of that part (and every internal part of it), and no error was found.
UPDATE 2:
After debugging some more, I found the error message:
File or assembly name 'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=xxxxxxxxxxxxx', or one of its dependencies, was not found.
Also the stack trace:
at System.ThrowHelper.throwVersion37CompatException(ExceptionType newEType,
String newString, ExceptionType oldEType, String oldString)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Windows.Resx..ctor()
at System.Windows.Resx.GetLoader()
at System.Windows.Resx.GetStringHelper(String name)
at System.Windows.Resx.GetString(String name)
at System.Windows.Controls.Primitives.ToggleButton.ToString()
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj,
IntPtr unmanagedObjArgs, Int32 argsTypeIndex,
Int32 actualArgsTypeIndex, String eventName)
you can set break for the first chance exception visual studio, debug in to see the detail about the FileNotFound exception, which file is missing.
sometime, clr try to find some extension dll, which is normally too magic to us. for example, if you use XmlSerialize in your project, if you don't use sgen.exe to generate the dynamic xml serialize dll for your serializble type, CLR will generate one during runtime, but before this, clr will try to load the assemble, which will cause FileNotFoundException, but catched
We have an application that we need to begin testing and developing in Windows 7 environment. It works fine compiling under WinXP in VS2008, no problems. However when I went to compile it on a windows 7 machine using VS2008 today I get the following error:
Error 12 The "GenerateResource" task failed unexpectedly.
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(MemoryStream stream)
at System.Drawing.Image.System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at System.Resources.ResourceWriter.WriteValue(ResourceTypeCode typeCode, Object value, BinaryWriter writer, IFormatter objFormatter)
at System.Resources.ResourceWriter.Generate()
at System.Resources.ResourceWriter.Dispose(Boolean disposing)
at System.Resources.ResourceWriter.Close()
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(IResourceWriter writer)
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(String filename)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, List`1 inputs, List`1 outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, List`1 inputs, List`1 outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
I cannot for the life of me run this one down. I have visited the msdn forums and find that it is an issue for a lot of people, but no consistent solution has been provided by MS or anyone else.
Has anyone seen this before and fixed it? Please advise is needed!
Thanks
I compiled using the command line msbuild and that identified the problem location.
It was a resx file in a class which had one unused image in it. I removed that and all was good again. Can build fine now.
After hours of troubleshooting, I opened and built the project using the VS 2010 command line prompt using MSBUILD "my solution file path here". This provided a more visible sequence of build events, and I found my project was failing just after it compiled form 16. The forms compiling appeared to be going in order of the objects in the solution explorer. So I checked the next form and found it contained a picture box. I also checked the form after that one and found I could not open the designer without errors(object reference not set to instance of object). So apparently, the problem was now two-fold.
To resolve I had to remove the picture box object from the first form I identified as problematic (it was not being used any way) as it appeared to be corrupted. I found the second form with the null reference exception was using a user control. The code for the constructor of the user control was attempting to pass an object to a container before calling InitializeComponent(). This created the null reference since the container hadn't event been created in InitializeComponent when the problematic code was called.
After resolving the issues in the above paragraph my solution compiled under Windows 7.
There is a GDI update for Windows 7, I think, if I'm not mistaken. Maybe that will solve the issue. Does your solution build using Msbuild on the commsnd line?
Do you use TIFF images in your app?
Some time ago, I also had a problem with TIFF images as part of reports that wouldn't compile under Win7 x64 although it compiled like a charm under Vista x86. The error message also involved GDI+. I saved the images under a different format (PNG) and the problem vanished.
At the time (around March 2011), I first ensured that my Windows was up-to-date but it didn't solve the problem. So maybe there is such an update as mentionned by Erik but it didn't come through Windows Update back then (Maybe it's newer).
Delete the resources from the resource manager (right click on each and delete) then add them back. for me it solve the problem.
i had same problem.
i just used msbuild myProject.sln command and it fixed and built successfully with no errors! now i can manually build my solution.
no need to reAdding my resources
How might I host a WinForms Control (or WPF Window for that matter) created in a different AppDomain on a form created in my application?
I'm trying to create a composite UI application that is a featureless shell/host for plugins, where those plugins run entirely in their own app domains, so I want to be able to get UserControl objects from those plugins to be "hosted" in some sort of container control on the host process's main form.
I thought I'd cracked it, but because conversations between appdomains involve MarshallByRefObject proxies, I can't take my first prototype approach of:
shellForm.Panel1.Controls.Add(proxyObjectForUserControlInOtherAssembly);
I've posted the exception I got from this at the end of the question.
I did have a go at getting the control directly:
var ctl = Control.FromHandle(proxyObjectForUserControlInOtherAssembly.Handle);
shellForm.Panel1.Controls.Add(ctl);
This gave predictable results. I got the hWnd okay, but Control.FromHandle() returned null. Presumably because the handle was created on a different appdomain.
I'd very much appreciate a poke in the right direction if I'm hopelessly off track with this. :)
Many thanks in advance.
System.Runtime.Remoting.RemotingException was unhandled by user code
Message=Remoting cannot find field 'parent' on type 'System.Windows.Forms.Control'.
Source=mscorlib
StackTrace:
at System.Object.GetFieldInfo(String typeName, String fieldName)
at System.Object.FieldGetter(String typeName, String fieldName, Object& val)
at System.Object.FieldGetter(String typeName, String fieldName, Object& val)
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at AppDomainTest.Shell.Form1.Display(Control control) in c:\temp\AppDomainTest\AppDomainTest\AppDomainTest.Shell\Form1.cs:line 24
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
InnerException:
I have been helpfully pointed in one possible direction by a colleague: .NET Add-in Framework
The key point from that page for my purposes is as follows:
The assemblies for these segments are
not required to be in the same
application domain. You can load an
add-in into its own new application
domain, into an existing application
domain, or even into the host's
application domain. You can load
multiple add-ins into the same
application domain, which enables the
add-ins to share resources and
security contexts.