Ribbon. The value cannot be null. Parameter name: obj - c#

I am adding Ribbon.
Instead of Ribbon, I am getting error.
Error:
The value cannot be null. Parameter name: obj
at Microsoft.Internal.VisualStudio.PlatformUI.Utilities.GetObjectData (IVsUIObject obj)
at Microsoft.VisualStudio.Tools.Office.Ribbon.ImageHelper.GetImageFromMoniker (ImageMoniker moniker, Size ImgSize, Int32 dpi, Nullable`1 backgroundColor)
at Microsoft.VisualStudio.Tools.Office.Ribbon.View.Themes.Office15Theme.GetFileMenuImage (Boolean hover, Boolean opened, Control control)
at Microsoft.VisualStudio.Tools.Office.Ribbon.View.Themes.OfficeTheme.GetFileMenuSize (Control control)
at Microsoft.VisualStudio.Tools.Office.Ribbon.View.RibbonView.InitializeComponent ()
at Microsoft.VisualStudio.Tools.Office.Ribbon.View.RibbonView.set_Site (ISite value)
at System.ComponentModel.Container.Add (IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.PerformAdd (IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent (Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance (Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance (Type type, ICollection arguments, String name, Boolean addToContainer)
at Microsoft.VisualStudio.Tools.Office.Serialization.TypeResolutionModifications.VSTDesignerSerializationManager.CreateInstance (Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize (IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at Microsoft.VisualStudio.Tools.Office.Ribbon.Serialization.RibbonTypeCodeDomSerializer.Deserialize (IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad (IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad (IDesignerSerializationManager serializationManager)
--- End of the stack trace from the previous location where the exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad (IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted (Int32 fReload)
Description.
I want to create an Excel Addin.
I created a project.
I am adding Ribbon.
An error is displayed instead of Ribon.
Question.
Why is there an error?
How to fix the error "The value cannot be null. Parameter name: obj"?
Used.
Wni - 7x64;
Visual Studio - 2019 Community.
Picture1.
Picture2.
Picture3.
Update-1.
Opened a project in Visual Studio-2017 Community.
Ribbon opens.
Question.
Why won't Ribbon open in Visual Studio-2019 Community?
Picture-4
Update-2
I made a right click - > I chose "Build".
Visual Studio has completed the "Build".
Visual Studio added a file to the Solution - ExcelAddInTest_04_TemporaryKey.pfx.
I added a Ribbon.
Result: Error.
The value cannot be undefined. Parameter name: obj
in Microsoft. Internal.VisualStudio.PlatformUI.Utilities.GetObjectData(IVsUIObject obj)
in Microsoft. VisualStudio.Tools.Office.Ribbon.ImageHelper.GetImageFromMoniker(ImageMoniker moniker, Size ImgSize, Int32 dpi, Nullable`1 backgroundColor)
in Microsoft. VisualStudio.Tools.Office.Ribbon.View.Themes.Office15Theme.GetFileMenuImage(Boolean hover, Boolean opened, Control control)
in Microsoft. VisualStudio.Tools.Office.Ribbon.View.Themes.OfficeTheme.GetFileMenuSize(Control control)
in Microsoft. VisualStudio.Tools.Office.Ribbon.View.RibbonView.InitializeComponent()
in Microsoft. VisualStudio.Tools.Office.Ribbon.View.RibbonView.set_Site(ISite value)
in System.ComponentModel.Container.Add(IComponent component, String name)
in System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
in System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
in System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
in System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
in Microsoft. VisualStudio.Tools.Office.Serialization.TypeResolutionModifications.VSTDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
in System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
in Microsoft. VisualStudio.Tools.Office.Ribbon.Serialization.RibbonTypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
in System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
in Microsoft. VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of the stack trace from the previous location where the exception occurred ---
in Microsoft. VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
in Microsoft. VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
Picture-1
Picture-2
Picture-3
Update-3.
I moved to Visual Studio-2017.
I created an add-on (project-1).
I added a Ribbon.
Ribbon is displayed.
I moved to Visual Studio-2019.
I opened a previously created add-in (project-1).
I opened the Ribbon.
Ribbon is not displayed. I get an error.
I started debugging (F5).
I opened an Excel file.
Result: Ribbon is displayed in Excel.

Related

Error in accessing Windows Forms Designer Editor - Requires license for the plugin

As above stated, I'm unable editing from the Designer mode a particular form.
Message:
Instances of this error (1)
1. Show Call Stack
at MapInfo.Licensing.MapInfoLicenseProvider.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at MapInfo.Engine.Session.SessionInternal..ctor()
at MapInfo.Engine.Session.Create()
at MapInfo.Engine.Session.GetCurrent(Boolean bCreate)
at MapInfo.Windows.Controls.MapControl.InitMapControl(Map map)
at MapInfo.Windows.Controls.MapControl..ctor(Map map)
at MapInfo.Windows.Controls.MapControl..ctor()
Help with this error
Could not find an associated help topic for this error. Check Windows Forms Design-Time error list
Forum posts about this error
Search the MSDN Forums for posts related to this error
Screenshot:
How would I be able to add that license and where ?
Any useful hints appreciated.

Logon Error : Catastrophic failure(Exception from HRESULT : 0x8000FFF (E_UNEXPECTED)) - Windows Forms

I get the error message below when i start my application without break points. As soon as i put a break point and hover over variables then i don't get it. I also get the error when i launch the application(Windows Forms) via exe in debug folder. The error message occurs when i try to access information from app config. This error started appearing as soon as i upgraded .net framework from 3.5 to 4.6.2 on my app. Please check my code below:
-- Main form.
Impersonator.StartImpersonation()
Dim Login As New frmLogin() --main form calls frmLogin
Login.Owner = Me
Login.ShowDialog()
Login.Dispose()
--frmLogin on load
Private Sub OnLoad()
If My.Settings.Test = "Y" Then 'breaks here. but if i over over My.Settings.Test it doesnt break
_DSN = My.Settings.ConfigTest
Else
_DSN = My.Settings.ConfigLive
End If
End Sub 'GetDSN
What could be the issue? I'm using visual studio 2017.
Here is the stack trace of the error :
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()
at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext()
at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext()
at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.Internal.ConfigurationManagerInternal.System.Configuration.Internal.IConfigurationManagerInternal.get_ExeProductName()
at System.Configuration.ApplicationSettingsBase.get_Initializer()
at System.Configuration.ApplicationSettingsBase.CreateSetting(PropertyInfo propInfo)
at System.Configuration.ApplicationSettingsBase.EnsureInitialized()
at System.Configuration.ApplicationSettingsBase.get_Properties()
at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
at System.Configuration.SettingsBase.get_Item(String propertyName)
at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
The issue was caused by Impersonator.StartImpersonation() . I removed Impersonator.StartImpersonation() line and every worked fine. It seems like .Net 3.5 supported Impersonator.StartImpersonation() without any issues.

An item with the same key has already been added when creating new WPF project

I just created a new WPF
project in Visual Studio 2015 Pro, and after the Creating Project dialog disappears, I do not get the designer. This ArgumentException just shows there and I have not added any controls or anything. Just created the project and I get this.
I have read this exception is thrown when I have duplicate files like a resx file with Resources.resx name or LIKE when I am using the same file twice but I am not doing anything else than creating a new project.
I can build the solution and the project successfully with no errors. I open the compiled EXE and it looks OK. But I cannot use the designer inside VS.
This WPF solution targets .NET4.5. I tried creating a new one targetting other .NET versions but the same happens.
[EDIT]
Here is the entire exception thrown by VS:
System.ArgumentException
An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Microsoft.VisualStudio.DesignTools.Utility.Telemetry.VsTelemetryService.RegisterDesignerProcessSession(Int32 pid)
at Microsoft.VisualStudio.DesignTools.Utility.Feedback.WatsonTracker.RegisterSession(Int32 processID)
at Microsoft.VisualStudio.DesignTools.Utility.DesignerSessionTracker.RecordDesignerStart(Int32 processID, String isolationTargetIdentifier, Boolean mockCustomTypes, String buildConfiguration)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, IIsolationTarget isolationTarget, String baseDirectory)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.Initialize()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()
at Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget, IObjectCatalog catalog)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry, IServiceProvider serviceOverrides)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func`2 func, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.<>c__DisplayClass10_0`1.<StartTask>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
Here is a screenshot too:
Hope someone can help me solve this problem. Thanks in Advance - CCB
I got the same exception and reduced both xaml and cs to a minimum without any help. I deleted folders bin and obj, restarted VS, rebooted my computer, but still no luck. With VS 2012 the designer was not loading with a different error message. This post helped me fix the issue
FIX: Delete or rename file "C:\Program" then click on "Click here to reload the designer".
In my case Program was a text file without extension from writing the output of an ipconfig MS-DOS command. There is no need to close the xaml designer, recompile, clear the cache, or restart Visual Studio.
Somehow VS tries to read it when loading the designer (checked with Process Monitor from Sysinternals). For information the stack in Visual Studio 2012 was the same as this bug report.
System.Runtime.Remoting.RemotingException
[] Designer process terminated unexpectedly!
at Microsoft.Expression.DesignHost.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain.Microsoft.Expression.DesignHost.Isolation.IIsolationDomain.CreateInstance(String assemblyName, String assemblyCodeBase, String typeName)
at Microsoft.Expression.DesignHost.Isolation.Primitives.IsolationBoundary.Initialize()
at Microsoft.Expression.DesignHost.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)
at Microsoft.Expression.DesignHost.Isolation.IsolatedExportProvider.Initialize()
at Microsoft.VisualStudio.ExpressionHost.Services.VSIsolationService.CreateExportProvider(IIsolationTarget isolationTarget, ICatalogFactory catalogFactory, IExportFilter filter)
at Microsoft.Expression.DesignHost.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
at Microsoft.Expression.DesignHost.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry)
at Microsoft.Expression.DesignHost.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
at Microsoft.Expression.DesignHost.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func`2 func, CancellationToken cancelToken)
at Microsoft.Expression.DesignHost.Isolation.IsolatedTaskScheduler.<>c__DisplayClassa`1.<StartTask>b__6()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

c# extended control in designer

I extended a control like so
public partial class NewControl : OriginalControl
{
public NewControl()
{
}
}
and changed these lines in the MyForm.Designer.cs from
private OriginalControl control1;
this.control1 = new OriginalControl();
to
private NewControl control1;
this.control1 = new NewControl();
How ever when I open my form in designer I get this error:
Failed to load designer. Check the source code for syntax errors and
check if all references are available.
ICSharpCode.FormsDesigner.FormsDesignerLoadException:
System.ComponentModel.Design.Serialization.CodeDomSerializerException:
Could not find type 'NewControl'. Please make sure that the assembly
that contains this type is referenced. If this type is a part of your
development project, make sure that the project has been successfully
built using settings for your current platform or Any CPU. at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager
manager, String exceptionText, String helpLink) at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager
manager, String name, CodeExpression expression) at
System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager
manager, CodeStatement statement) at
System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager
manager, Object codeObject) at
ICSharpCode.FormsDesigner.Services.ProjectResourcesComponentCodeDomSerializer.Deserialize(IDesignerSerializationManager
manager, Object codeObject) at
System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager
manager, Object codeObject) at
ICSharpCode.FormsDesigner.Services.ProjectResourcesComponentCodeDomSerializer.Deserialize(IDesignerSerializationManager
manager, Object codeObject) at
System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager
manager, String name, CodeStatementCollection statements)
System.ComponentModel.Design.Serialization.CodeDomSerializerException:
The variable 'control1' is either undeclared or was never
assigned. at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager
manager, String exceptionText, String helpLink) at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager
manager, String name, CodeExpression expression) at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager
manager, String name, CodeExpression expression) at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
manager, CodeStatement statement)
at
ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadDesigner()
at
ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadAndDisplayDesigner()
at
ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadInternal(OpenedFile
file, Stream stream) at
ICSharpCode.SharpDevelop.Gui.AbstractViewContentHandlingLoadErrors.Load(OpenedFile
file, Stream stream)
How am I extending my control wrong?
This may purely be an issue with the namespaces in which these two controls appear. See if a fully qualified class name happens to solve you issue.

Compiler Issue in Windows 7: A generic error occurred in GDI+

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

Categories