Why does Inspect.exe not display the AutomationId and other UIAutomation properties when running in debug? - winforms

I've been using Inspect.exe from the Windows SDK to examine the properties of a WinForms application but noticed that I didn't see any of the properties (for example, the AutomationId) whilst running the application from Visual Studio (F5 to run.) However, if I ran the .exe from the bin\debug folder I could see the properties fine.
The source I was using was example code downloaded from UI Automation Custom Provider Samples - Part 3.
I'm wondering why this happened since I'm sure another machine that I had tried this on worked fine and I wasted time poking around in debug mode wondering why my UI Automation properties weren't visible. Obviously there's a workaround but I'd like to understand why this was happening and have a record of the problem for other people to find!

I've struck upon the answer - because I had launched Visual Studio as Administrator but the Inspect.exe tool as standard user then the properties being reported back were a sub-set of what I should have seen. As soon as I launched Inspect.exe as Administrator it worked!

Related

Visual Studio hangs when adding forms or opening designer

I have a major problem with a Winforms application with a large number of projects. VS 2019 threw an exception and closed a few days ago, and on reopening restored two files since then I have been unable to:
Add a new form to the vast majority of projects, whether the most basic MS template or not
Open the designer for any form that is already in the vast majority of projects
Access the navigation bars (the three combo boxes at the top of the VS work area that normally contain the project, namespace and content information) on any class referencing to WinForms in the vast majority of projects
When trying to do either of the first two things an 'Opening File' message is shown endlessly. If you try to do anything, a notification is shown that Visual Studio is busy, and that Microsoft will be notified but nothing else happens and you can only get out by using the Task Manager to kill all VS tasks.
In the case of the third one, a message is shown saying 'Refreshing Navigation Bars' but again it goes on forever. However, in this case you can click the Cancel button to cancel the loading attempt.
The navigation bars issue I believe is Resharper related. In addition CodeLens is not working at all, so the space for the number of references is generated but there is no content. This is true for ALL files in the solution, not just the form related ones.
Here is what I have tried so far:
Cleaned and Rebuilt the solution - works fine but no difference
Built and deployed the solution - works fine
Deleted the SUO file and reset
Cleared the Resharper caches
Disabled Resharper
Performed a repair install of Visual Studio
Created a new Solution and added forms etc. which was unaffected and worked fine
Opened a different solution which was also working fine
Tried the same processes with a Project in the same solution that is not part of the application (TestBed) and that works fine too, but is the only project that does
Can anyone suggest where to look now? Since new and existing solutions work OK except for this one I am assuming that it is something Solution related rather than something related to VS itself, but I have no idea what that might be. For example, what is it trying to do when it says 'Opening File' (apart from the obvious - opening a file :-)) and what could cause that to fail? Am I looking for something in the Solution file, or could it be something else?
All suggestions and assistance towards resolving this issue would be gratefully received.
Thanks to Jasimov for the only response, I appreciate your attempt to help.
I have now resolved the issue using the following steps:
Uninstall Visual Studio 2019 Community Edition
Perform a fresh install of Visual Studio 2019 Professional
Reload the main solution
Clean the solution
Rebuild the solution
Deal with some issues that were highlighted in the Output and Errors, none of which were directly forms related
Rebuild the solution
Run the application and ensure it runs as expected
Go back and select forms at random and try opening them. All now work as expected.
In addition CodeLens is now working not only properly but actually better than before giving more information more quickly. On the other hand, I have not yet reinstalled Resharper which will be the next step.
I have included all the steps I took just in case anyone else has a similar problem. I have not been able to find this exact issue anywhere else in my searches so I hope it helps someone.
UPDATE: I have since re-installed Resharper with no problems and the designers are all working fine so now back into full flow!
I had a similar issue with the web forms designer in VS2019 hanging as soon as I clicked on anything on the design surface. The same projects were OK in VS2017. Uninstalled VS2019, rebooted, reinstalled VS2019, found that the designer was now working OK. Progressively added back 3rd party toolbox components, one VSIX, and the .Net 4.8 targeting pack. Still working. Thanks for your hint about the reinstall.

All converted apps including samples fail to run with a 'The parameter is incorrect'

I'm trying to convert a WPF oneclick installed application and so everything should be pretty straight forward. However, whenever I run the debug project, I get
'The parameter is incorrect'
in a message box popup and I can never run the app.
This happens for my app while trying to debug, all the samples from github, and even the DAC application from the Windows Store. The error pops up even once the app is installed and showing in my application list.
I'm on the latest build of the Creators Update.
There are various errors in the event viewers, but they seem to be a common occurence for WinRT apps.
Any ideas at all?
If you have the WPF project in VS2017, I'd recommend to package directly from VS without using the DAC. see the article for more information https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net
The problem appears to be related to the May Security Update. I restored Windows to the factory defaults and everything works fine.
However, once I install the the May Security Update to address this bug with Sql Server and Filestreams, the Desktop Bridge Debugging project stops working.
I'm going to throw out a random guess that it's related to the Microsoft Malicious Software Removal Tool, as the event viewer logs mentioned an issue with the 'parameter is incorrect' referring to the Microsoft.MRT.
Of course it could be anything, and as only 7500 people have even downloaded the Desktop Bridge Debugging project in the first place, I doubt it's high on the list of Microsoft Developer Priorities.
And to be completely honest, it's really probably my fault for not rewriting the app as a UWP app, after rewriting it as a Windows Forms app, and as a Silverlight app, and as a WPF app and on and on and on. Although, I'm not sure how many glasses of Kool Aid are left in the punch bowl for me.

Debug ActiveX control with Visual Studio 2010

Bit of a strange and very annoying problem.
I'm using Visual Studio 2010 for an ASP.NET webforms project. I was able to set breakpoints in an activex control, load the page and then attach the Visual Studio debugger to the Internet Explorer process running (shows up as Type 'Script, T-SQL, Managed) then reload the page and my breakpoints would be hit.
However, after several small subtle changes (and lots of tidy-up changes), when I do the same thing, my breakpoints are not hit. The breakpoints look okay - the main change is when I look at the Debug > Windows > Modules screen, there are now no references to the iexplore process, even though the debugger is still connected to it.
I'm a bit reluctant to undo all my changes but I suspect that it might be down to ip addresses. Most of the code should run as an ipv4 address but I suspect that the Visual Studio debugger is running with ipv6 address.
Has anyone come across this type of issue, where ip address versions are messing up debugging processes?
Okay, found the solution to this after a week! It was nothing to do with IP addreses. The ActiveX component was limited to .NET 3.5.0 and so when it was loaded by IE, it ran in .NET 2.0. The rest of the project was .NET 4.0 and when Visual Studio was debugging it automatically debugged code type 'Automatic: Native' which defaulted to .NET 4.0. Although I could attach to the IE process and all the breakpoints looked ok (solid circles), none of them were hit because no symbols were loaded. Clicking the 'Select' button when attaching to the IE process, allowed me to choose Managed(v2.0, v1.1, v1.0) code and the breakpoints were hit. You can't debug both .NET 4.0 and .NET 2.0, but you can use two seperate instances of Visual Studio to debug your complete project.
Hope this helps anyone else who trips over this one like I did.

Editing a Form in Visual Studio when TFS is offline

I'm running Visual Studio 2010 and using Team Foundation Server, and this thing is pissing me off no end.
Here's the scenario: since I work from home it often happens to me to work at strange hours or on the week-end, when our TFS is offline. This has never been a problem, since usually I just reload the solution and when VS detects that the TFS is not available it promprts you to work offline.
Now, I usually work on WPF projects, and working offline has never be a problem, even when editing XAML files it works with no issues. But now I have to edit a Form from a Windows Forms project, and VS refuses to collaborate. Whatever I do to the form, VS just does nothing other than playing that obnoxious "bing" sound that usually plays when an error of some kind occours. It doesn't even popup an error dialog box, just does nothing!
Any ideas??
Ok figured it out, I had to remove the "Read Only" attribute from ALL the files in the project (I had tried with the project file and form file, but that isn't enough evidently).

compile error when creating a new SL4 navigation app

I created a new Silverlight Navigation Application using Visual Studio 2010. I didn't make any changes to the code. Just Pressed F5 to run. I get the following error message:
The type 'System.Windows.Navigation.NavigationEventArgs' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.Controls.Navigation.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.dll'
I right clicked the Silverlight Navigation Application folder in the solution explorer and changed its "Target Silverlight Version" from Silverlight 4 to Silverlight 3 and then ran the application (by pressing F5) and it works fine.
I've already spent a lot of time trying to fine a solution. I want to develop application using Silverlight 4.
Would really appreciate any help with this.
Regards,
Vivek
It sounds like you have Silverlight 4's runtime, but an older set of VS tools or an older SDK, or your project is somehow referencing the older SDK.
Basically, that type moved from the System.Windows.Controls.Navigation DLL (where it was in SL3) to System.Windows.dll (where it is in SL4). CLR type-forwarding should take care of this.
Since Silverlight version numbers on assemblies didn't change between SL3 and SL4 it can be somewhat hard to tell if you're in the situation where you have outdated tools/SDK. Check the last modified date on System.Windows.Controls.Navigation.dll and see if it looks like about the time SL4 was released, or check if the Frame control has a property called ContentLoader - if so, you have the updated bits (and my answer is thus not helping). If not, however, then try reinstalling the SL4 Tools and/or SDK and check that your project is referencing the v4 Navigation assembly.

Resources