I developing WPF application in Visual Studio 2013 Update 5 on windows 7 x64 SP1. After starting program download xml-file over http and parse it. All worked fine until today, and problem is that exception begin occurring suddenly, no significant changes were made in project, no new references were added.
Now while starting program throws System.Windows.Markup.XamlParseException with message "The method or operation is not implemented" and it occurs even before InitializeComponent() so no one line of my code executed. Then I looked into IntelliTrace window in Visual Studio and found a chain of exceptions, top of them is System.EntryPointNotFoundException with message "Unable to find an entry point named 'EventSetInformation' in DLL 'advapi32.dll'".
Searching give me this and this talking that EventSetInformation is windows 8+ only. So windows 7 missing this method and here is exception, but how could my program reference this method while it (program) is not related to windows 8, not a bit?
I can also assume that there is some Update-5-related components inside Visual Studio that can trigger this advapi32 method, but if so - how can I disable this feature?
Edit
Program using .NET 4.5
Exception info:
System.Windows.Markup.XamlParseException occurred
Message=The method or operation is not implemented.
Source=PresentationFramework
StackTrace:
in System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
Edit2
As Steve and Hans noticed in comments, actual problem finally wasn't related to advapi32 library. I had a WindowEx class derived from Window with some custom stuff, and my visual window was derived from this WindowEx. Maybe my custom class missed some method (if to believe exception message), but after switching base class back to Window and putting custom logic from WindowEx directly to visual window, error was gone.
For completeness of this question, here is answer with copy of question's last edit:
As Steve and Hans noticed in comments, actual problem finally wasn't related to advapi32 library. I had a WindowEx class derived from Window with some custom stuff, and my visual window was derived from this WindowEx. Maybe my custom class missed some method (if to believe exception message), but after switching base class back to Window and putting custom logic from WindowEx directly to visual window code-behind, error was gone.
Related
I am getting a COM exception when running Coded Ui tests on windows 10. Is there a specific dependency I need to provide for windows 10 in order to run coded UI?
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotAvailableException: The control is not available or not valid. ---> System.Windows.Automation.ElementNotAvailableException: Element not available ---> System.Runtime.InteropServices.COMException: Operation timed out. (Exception from HRESULT: 0x80131505)
The reference for the namespace Microsoft.VisualStudio.TestTools is a little bit hidden.
You need to reference the DLL Microsoft.VisualStudio.QualityTools
I'm working on a Windows 10 Store Windows Universal app using Visual Studio 2015 Community, c#, and XAML. It is decompressing a compressed file and displaying images found therein.
The build provides 0 warnings.
The debug version runs fine regardless of input file size.
The release version runs fine with typical input file sizes.
For large input file sizes (~100 1 megapixel images), the release build crashes consistently with 'Unhandled exception at 0x55E9A305 (Windows.UI.Xaml.dll) in appname.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x127DC468, 0x00000005).'
The crash occurs when the user tries to display the second image. All decompression is complete and all the bitmaps have been created by this time.
I've fiddled with the Build settings and narrowed down the difference to the option 'Compile with .NET Native Tool chain'. If that option is checked, the application crashes. If that option is unchecked, the application runs fine.
All told, the application is using about 400 MB of heap so although not small it isn't near the capacity of the machine.
"So uncheck the option!", I hear you cry. Unchecking the box leads to the certification failure shown below:
FAILED
Supported APIs
• Error Found: The supported APIs test detected the following errors:
-API OpenSemaphore in api-ms-win-core-synch-l1-1-0.dll is not supported for this application type. System.Threading.dll calls this API.
-API CreateSemaphore in api-ms-win-core-kernel32-legacy-l1-1-0.dll is not supported for this application type. System.Threading.dll calls this API.
-API ExecuteAssembly in uwphost.dll is not supported for this application type. StupidTest.exe calls this API.
-API DllGetActivationFactory in uwphost.dll is not supported for this application type. StupidTest.exe has an export that forwards to this API.
An empty project suffers the same failure if Compile .Net Native tool chain is not selected.
So my questions:
Must Universal Apps use Compile .Net Native tool chain?
Is there any documentation on the meanings of the parameters in the internal exception or somewhere else I can turn to troubleshoot?
In short, any advice on getting out the "It doesn't work if selected, but you must select it to get certified" dilemma I find myself in?
I struggled with this issue also for the past few days, and I've found the answer!
So if you haven't updated Visual Studio 2015 to Update 1, do it. Because this error is a bug in the compiler and after the update you will be able to build the project with the Compile .Net Native tool chain option selected.
And yes, those four errors that the WACK tool picks up, is because of compiling your project without checking the .Net Native tool chain option in the Build menu of the Package.appxmanifest file.
Since converting our company inhouse winforms application from a VS2008 to VS2012 project I have problems using the winforms designer.
Sometimes the designer falls into an error state giving the following error message:
"Collection was modified; enumeration operation may not execute." with the call stack saying:
Instances of this error (1)
1. Hide Call Stack
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblySpecFound(List`1 assemblies, String assemblyFullName)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AddDependencies(Assembly a, String fileName)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchByShortName(String partialName, String fullName, AssemblyEntry[] entries, Assembly& assembly)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchNormalEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, Boolean fastSearch)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName assemblyName, String typeName, Boolean ignoreCase, Assembly& assembly, ReferenceType refType)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetAssembly(AssemblyName name, Boolean throwOnError)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetAssembly(AssemblyName name)
at Microsoft.VisualStudio.Design.VSDynamicTypeService.OnAssemblyResolve(Object sender, ResolveEventArgs e)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
It seems that the designer is trying to change the list of referenced assemblies maybe because of some invalid assemblies.
While trying to solve the issue I figured out that changing the "Enable ClickOnce Security" option under Project->Properties->Security can bring the designer back to work. BUT if the option is turned on and I get the designer error turning it off and rebuild all can solve the problem from time to time and VICE VERSA!!!! ... That's why I'm a little lost right now.
I had the same problem, which drove me crazy all day. The cause (apart from the Visual Studio bug itself of course) was that my project was missing an assembly reference. To be precise, it referenced two assemblies A and B, where A itself also referenced B - but in a different version from the one I used. I should have referenced the same version of B that A referenced.
What it boils down to is: My assembly references weren't quite right. They were right enough for the code to compile and run just fine, but wrong enough for the WinForms designer to crash.
To find the problem, I started a second VS instance and attached its debugger to the first one that had my solution loaded (Debug | Attach to Process). Then in Debug | Exceptions, I activated breaking on thown Common Language Runtime Exceptions. Now, in my first VS instance, I double-clicked the form to open it.
I got multiple exceptions in a row, most of which had nothing to do with my code. But one of them was a FileLoadException stating: "Could not load file or assembly 'XXX, Version=3.7.0.25089, ..." So I added a reference to the correct version of the assembly. (And by correct, I mean down to the last digit - the WinForms designer is terribly pedantic when it comes to assembly versions.) And next thing I know, the form opens like a charm!
It seems to be a generell Visual Studio 2012 Bug.
Here is the offical mail I got from Microsoft
Greetings from Microsoft Connect!
This notification was generated for feedback item: VS2012 WinForms Designer doesn't work anymore -Error: Collection was modified; enumeration operation may not execute.which you submitted at theMicrosoft Connect site.
Thank you for your feedback. This bug is a duplicate of the one reported here:
http://connect.microsoft.com/VisualStudio/feedback/details/781193/form-designer-error-collection-was-modified-enumeration-operation-may-not-executethere
Please monitor that issue (781193) for further updates. There are no workarounds available, but we are fixing this issue in the next release of Visual Studio.
I'm looking at code that is new-to-me. I have c++ code in a project called UI, with a number of dependencies, which builds correctly and doesn't return any errors. In the same solution in Visual Studio 2008, I have created a new C# windows forms project and added a reference to the dll generated by the UI project, and added a "using" statement. What I want to do is raise one of the dialogs that are defined in the UI project, so I have code like
UIDialog uIDialog = new UIDialog();
uIDialog.Show();
which builds.
When I run my project in debug, when it gets to the "new" part, I get the exception above - with no information as to what the missing module is.
Is there any way to find out what the missing module is, without digging through the code in the UI project?
(I'm trying to rephrase this question so that it doesn't get closed. If someone could give the definitive answer of "No, there isn't" I'd find that very helpful. Thanks also to those who closed the previous version.)
Edit:
System.IO.FileNotFoundException occurred
Message="The specified module could not be found.
(Exception from HRESULT: 0x8007007E)"
Source="ui"
StackTrace:
at ui.UIDialog.Startup()
at ui.UIDialog..ctor() in c:\..\ui\UIDialog.h:line 61
InnerException:
That's the problem, there's no useful information anywhere obvious!
It's not a 32/64 bit problem - before getting here, I had the typical "BadImageFormatException", so to get past that I forced everything to be 32bit.
You could use the MSIL Disassembler on the referenced dll and check the manifest for all the dependencies of the dll. The disassembler is part of the Windows SDK tools.
Or there is always DependencyWalker, though I haven't used it in years.
You can turn on Fusion logging to see what the loader is doing and find out what's missing.
I have a user that keeps getting this error. Is there a tool that does window handle counting that i can use to figure out why he keeps getting this error.
System.ComponentModel.Win32Exception: Error creating window handle.
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
If the Form you are creating overrides WndProc(), be careful to ensure that it always calls base.WndProc() during the window creation process.
I inadvertently omitted a call to base.WndProc() in my override, and got your stack trace.
The best counter I know is Taskmgr.exe. View + Select Columns and check "User objects", "Handle count" and "GDI Objects".
The generic diagnostic is that you're leaking handles and consumed 10,000 of them. Beware of a handle leak bug in .NET 2.0 SP1 and .NET 3.5's Graphics.CopyFromScreen(), fixed in 3.5 SP1.
Maybe this could help:
Unhandled exception Win32Exception,Error creating window handle
CLR Debugger (DbgCLR.exe)
on mine machine debugger is located at:
"c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\GuiDebug\DbgCLR.exe"