Visual Studio: edit xaml while debugging (without stopping debugging) - wcf

I've got the very same problem as this question: Edit Xaml while debugging with a twist.
My debug session usually runs some code while I need to change stuff in the XAML, and if I detach all, as recommended as answer in that question, the debugged program might run on, but the WCF services which are also hosted in the debugger will be stopped immediately.
And without service my programm usually last mere seconds.
So, is there a way to exit xaml files during debugging? I don't care for debug and continue, I'm aware the changes will take effect only after a restart of the app. I just need to type in some stuff so I won't forget and am annoyed that I have to use an external editor instead of VS.

I always use another tool. Like notepad++ or expression blend.
You can configure this by right clicking the file -> open with. Or with expression blend you get the open in expression blend option and its pretty good for xaml anyways.

if you need dynamic build you can take a look at project Roslyn
more info here
"Developers could also use the output of such software to do tasks like refactor, or reorganize, their code more easily, to add C# and Visual Basic functionality to programs written in other languages. It also adds dynamic typing to the statically typed C# and Visual Basic, allowing developers to add objects and new variables to a program on the fly."

Related

Is there a way to embed a debugger in a vb.net application?

There is a program/service running on different systems executing vb.net scripts.
The application running and managing the scripts is also written in vb.net.
I want to implement the option to debug the scripts directly on the different systems the scripts are running on.
So I am looking for a debugger that can be embedded in a vb.net application.
Ideally the solution would provide code highlighting, Watches, Stepping through the code,
a way to easily add libraries.
A colleague told me there is a way of embedding VS Code in an application, yet I have not found a way to implement the described requirements.

Debugging late binding operations cannot be converted to an expression tree in visual studio

When publishing a VB web app to Azure with Precompile During Publishing option selected and Allow Precompiled Site To Be Updateable de-selected the preview fails with "Late binding operations cannot be converted to an expression tree."
I'm willing to bet it's a linq query referencing an object property but I can't find it.
I feel like an idiot here. The project builds fine with no errors (Option Explicit, Option Strict are on; Option Infer is off in compile settings).
How do I debug for this error in Visual Studio?
I feel rather idiotic here.
I was previewing the deployment and looking at the VSDeploymentFailure.txt file which has no details on the error.
Finally, I actually tried to publish the app and, when it failed, the output window showed me right where I had late binding in a few razor pages (turns out it wasn't a linq issue).

Is there a possibility to change other's application code in Visual Basic?

I have just reversed a crackme in OllyDbg, and I was wondering if I can modify its code with application written in VB.NET. For example, to change JNZ (on specified address) for JMP.
EDIT:
I see there is a misconception. I was talking about creating patcher in Visual Basic.NET(programmatically change EXE code) to patch already reversed application. I know about Write/ReadProcessMemory that allows me to inject code after application execution(in that case it's loader not patcher), but how to overwrite EXE permanently?
Changing JNZ to JMP is kind of bypassing some kind of verification inside application (serial number of if it is purchased or not, so if you have the source code, you can just comment which lines you don't want your application to execute
Patching a compiled program is possible with certain tools, you can even do that in runtime with code injection.
But, as i understand from your question, you're talking about a vb .NET application and not a regular VB application.
VB .NET applications compiles to bytecode (MSIL code) and not binary like regular VB applications, which makes it even more easier to reverse, you can actually "decompile" the .exe file to it's source code with a tool like ILSPY (see google), patch it, and then re-compiled it.

What StyleCop like tools are there for VB.NET

see also VB.NET Static Code Anaylsis
For better or for worst we now have a VB.NET coding standards document that is based on a C# coding standard as enforced by StyleCop.
For example
the number of spaces you should put in each side of a “+” sign etc
all instance Members (fields and methods!) must be access as “me.fieldName”
all shared members must be accessed as “className.fieldName”
As I tend to think:
If it’s in a requirements document it
should be check for by an automatic
system
I am looking for (ideally free) tools that will check for that short of rules on VB.NET code, as these are style issues that don’t make it into the compiled output, FxCop is not useful.
(I would personally match rather that we just check for important things like duplicated code and single reasonability for each class (so no more multi thousand line classes!), but as I need to keep to the coding standard document I wish to have a tool to help me do so.)
see also Enforcing using the class name whenever a shared member is accessed.
About the bounty.
I am looking for a list of VB.NET code checking tools, with a short summery of what each tool can do and its limitations. If the tools are not free, please include some ideal of cost.
Does anyone have experience using CodeRush/Refactor! or ReSharper with VB.NET to check for this type of coding style issues?
I know of no free source code analysis tools with good VB support. There are, however, at least two commercial tools that may be suitable:
submain CodeIt.Right
SSW Code Auditor
Personally, I prefer the CodeIt.Right rule authoring mechanism, so I would favour it if considerable custom rule development were planned. However, if you just want to use out-of-the box rules, Code Auditor ships with quite a few more code style rules than CodeIt.Right, most of whose built-in rules target the compiled IL (like FxCop).
The only ones I know of are:
Microsoft's FxCop
Of course, this only operates on compiled assemblies, so doesn't give the same functionality as StyleCop, and certainly won't help with things like naming schemes.
However, the closest thing is:
Aivosto's Project Analyzer v9.0 for Visual Basic, VB.NET and VBA
The full version is not free, but this is the closest thing to StyleCop for VB.NET that I can find.
There have been a number of calls for a VB.NET version of Microsoft's StyleCop, such as those in this thread on the code.msdn.microsoft.com site. That same thread also gives some good insight into why a VB.NET version doesn't exist.
I use ReSharper on a daily basis and I find it fine for both code formatting and for solving naming issues. It allows to configure how naming must be enforced, how issues are displayed (hint, suggestion, warning, etc) and provides a precise code formatter (space, paranthesis, line breaks, this qualifier, etc).
Note that I don't know if it can be run in batch mode.
Turning Option Explicit on by default is always a great idea and should be standard practice. I would argue it should be turned on by default in VS out of the box. But it doesn't come close to enforcing the out of the box rules that StyleCop does for C#, nor does it allow for you to create your own rules.
The whole reason for StyleCop's existence is because FxCop only works on compiled assemblies, leaving web projects out in the cold for a similar tool. With StyleCop, web developers get the same great rule enforcement and tight VS integration. It is a great tool for any C# developer.
It is unfortunate that it is only C# capable, a VB version would satisfy a large community that is left wanting something similar.
There already is a very good style tool built into the VB compiler. It is called Option Explicit On, put it at the top of the source code file or use Tools + Options + Project and Solutions + VB Defaults, Option Explicit = On. If that wasn't turned on previously there could be a mountain of errors when you compile your code after changing that.
If it is clean or already turned on, consider that you are 95% close to writing clean C# code and that the language doesn't really matter anymore.

Programmatically accessing an application through its UI

Earlier I asked a question about command-line parameters to automate processing of a file in InfoPath. I'll probably get the Tumbleweed badge for that one.
Instead of attempting a batch solution through the command line, can someone suggest a good resource for developing a solution that will open an application and then perform actions through the application's user interface like opening a file, printing it, and closing the file?
I've seen a legacy application do this in the past where it would open Attachmate and perform I/O operations through Attachmate's interface - but I never saw the code.
One constraint is that the process will be initiated from an existing .NET solution (i.e. processing 10,000 files). I am also unable to rely on traditional Office macros like those found in Excel - InfoPath does not appear to support them.
One option for automating a GUI based application is to use AutoIT. It will allow you to script the actions that are necessary for clicking menu interfaces, working with dialogs, etc.
Depending on your needs, you can create an AutoIT script on your dev machine, compile it to a standard EXE, and deploy it with the .NET project's compiled artifacts. To pass data to it, either you have your AutoIT script take command line parameters, or you have the .NET solution write a to a file with all the input file parameters and have the AutoIT script read in the file to process it. Based on the number you have in the question, I'd go with the option of writing to a file.
Since you are already on .NET you might want to give the new UI Automation framework a try. I haven't tried it yet, but it is supposed to work with WPF and native Win32 applications.
MSDN also has some samples: UI Automation Control Pattern Samples
Attachmate has a scripting language, an API and all kinds of other stuff to help with automating it. So this may not have been a typical application.
On the other hand, Attachmate products are (IMO) horrible to the extreme and I will go to great lengths to avoid working with them in the first place.