Force VS to update initialization code - vb.net

VS2008, VB.NET, Windows 7 Pro
I am creating a component to be dragged-and-dropped from the VS Toolbox onto
a developer's Form.
The component can display a UI at any time after it's Sited through which the developer can enter a value.
I would like to embed that value in an executable subsequently compiled by VS, so that the executable later "knows" that value.
If I put that value into a component Property, VS writes the value into the auto-generated Initialization code for the Form, which determines what gets embedded. VS does this reliably when it Sites the component.
It also does it when the developer adds a new Component to the Form, Deletes one, or changes a Property value with the VS PropertyBrowser.
But the value is not available until after Site, when VS has already completed its update, and I can't rely on Developers to do the VS UI work required to get VS to do it again. Does anyone know how to programmatically force VS to update the auto-generated Initialization code at a moment of my choosing in Designtime? (I.e. just after the developer uses my UI to set a value?)
Many thanks for your wisdom.

Related

App modeller, Identify button not showing up in blueprism spying

I am creating calculator VBO in blueprism object studio.
In application modeller I gave calc.exe path and able to launch calculator, but I am not getting identify option to spy on any element..
In Element, After clicking Launch buttion, identify is appearing for a split of sec and Launch button is coming back instead of Identify
PS- As mentioned in videos and links, I have launched calc via application modeller not directly via windows..
I am using windows 10, BluePrism V.5.0.11.0 versionenter image description here
Windows 10 calculator is complicated case, please consider using different application in your training. For example paint is much simpler to get started.
If you really need to get that going, then you may need to launch application first, using one object, and afterwards use second object to attach and interact with it.
can be two reasons
1. Either your application is not launched properly.
2. Sometimes we face problems with some versions of applications.
The best way to fix your problem is
Edit your settings remove the application path from the navigate stage.
Launch the application separately
Open Navigate stage > Action > Attach
Provide the window title within quotes (example: "Calculator")
Click OK then run the object
Now if you go to application modeller
You will be able to see the identify button under the element.
Hope this will help you.
I resolved this by unchecking "Disable invasive techniques (hooking)".
The Windows 10 calculator runs with process name win32calc which is also located under c:\windows\system32.
So when you launch the application please make you identify the applications process name and its location
I resolved this by circumventing to windows 7 calculator instead of a windows 10 calculator on windows 10.
Link to download win 7 calculator for win 10-
https://winaero.com/download.php?view.1795
This will be installed in the same place as your default calculator.
Inside-
C:\Windows\System32
The name of the app in my case was "calc1.exe" to avoid collisions with the default calculator.
I used this as my base reference app for spying and it worked.
Also note, the hover to highlight button seems to be a bit buggy, try a bit hit and trail to get you required button to be highlighted and mark using "Ctrl+LeftClick"

why does Visual Studio modify "Windows Form Designer generated code" on designer open?

When working w/ a WinForm project in VS.NET 2015, our team has noticed that the mere act of opening a .VB form in the designer view (default action when double-clicking the file in Solution Explorer) will cause VS to modify many object properties in the "Windows Form Designer generated code" section of the actual .VB code-behind. It seems to be limited to the .Size and .Location properties for sometimes dozens or more of UI objects, always changing their X,Y coords just slightly.
Mind you we don't perform any action to drive this -- simply open the file (obtained from source-control and residing in the local solution/project) in VS.NET's form designer by double-clicking the file in Solution Explorer, and bam -- it has the "unsaved" asterisk and if you save it and compare to source control version you can see the modifications already made.
I couldn't find much on this. Is this a known behavior? Any idea why it does this? Kind of reminds me of the old days w/ MS FrontPage's designer view, and even the early days of ASP.NET in VS which would apply some HTML changes if you opened a WebForm in designer view, until they gave the option to disable that on a later release.
thanks for any input.
UPDATE: this appears to be continuing even with myself as the only editor of the .VB form in designer. various form elements are shifting their position very slightly. Here's a diff screenshot between my last check in and today, and I know I'm the only one editing:
...there are many like that. Always these two properties, always just a few pixels difference.
I don't have an specific answer for this, but since this drove us crazy a bit a few months ago with my team, while working on a WinForms project, I am glad to share my experience!
Every time someone opened any form on VS2015, it would ask other people who has the same solution open at that time to reload the code. We first thought the third party controls (at that time it was both DevExpress and Infragistics) we are using were re-generated on designed initialization - because they tend to do that a lot but then we realised this kept happening on forms that only contains .NET controls.
Now the funny part. This only happened to us on VS2015. We were using VS2013 before, without this annoying problem.
Long story short, then we realized the screens we are using have different DPIs, just like Cody Gray said. I am not absolutely sure if this was the reason, but since we started using TFS, obviously we don't have the problem anymore... Hope this helps somehow lol.

NullReferenceException in SharePoint 2010 page layout after restore

It is SharePoint 2010 publishing website. I have a page layout with some user controls added to it. These users controls have rad editor controls in them. Everything was working perfectly unless one day I restored a backup from production to my dev and test environments. This page on dev and test environments started to give "System.NullReferenceException: Object reference not set to an instance of an object.". When I debug the controls are actually null, and debugger comes directly to set function for the fields, it does not call page_load function before coming to setter.
These same controls are working in other page layouts even after backup restore. The only difference I see in page layouts where these controls work and don’t work is AutoEventWireup="true". I tried adding this attribute to the page layout which is not working but SharePoint started to give error that this attribute is not allowed. Now no matter what I do, add or remove this attribute from my layout I keep getting error.
Another difference I noticed is that this layout was previously updated, other layouts were most probably never updated after website was migrated from MOSS 2007 to SharePoint 2010.
The only way I can make these pages work is by removing these controls from the page,
please help me find a solution to this situation. I have already read a bunch of articles about "AutoEventWireup" I am not sure if this is the problem, nothing seems to provide a solution in my current situation.

VS2012/ Blend 5: Debugging an Exception (only) occurring in design view

I'm developing a Metro-style app (for Windows 8) using C# and XAML. I have set up my viewmodels to be used as design-time datacontexts, like so:
xmlns:vm="using:hub.ViewModels"
d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type=vm:ViewModels
My app appears to work perfectly when run, but in the design views of both VS 2012 and Blend, I occasionally get this (unhelpful) error message:
An Exception was thrown. TargetException: Error in the application.
Stacktrace
at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
InnerException: None
This only happens in the design view - meaning I can't set breakpoints around all my INotifyPropertyChanged() events.
What is the best approach to debugging design-time errors?
If this happens consistently or semi-consistently, you can attach the debugger to the XAML designer:
Start Visual Studio; open your project and open a XAML file, causing the XAML designer to load
Start a second instance of Visual Studio. Open your project but make sure no XAML documents are open.
Ensure that Just My Code is disabled: From the Tools menu, select Options. Select the Debugging category. In the General page, ensure the check box next to Enable Just My Code is unchecked.
From the Debug menu, select Exceptions... and check the Thrown check box next to Common Language Runtime Exceptions. This will enable first chance handling of all CLR exceptions. If you know the specific type of the exception, you can enable first chance handling for just that type.
From the Debug menu, select Attach to Process. In the Attach to: field, click Select... and check the Managed (v4.5, v4.0) entry in the list and click OK.
This is necessary because the debugger may misdetect the process as a native process if it attaches while the process is executing native code. If your project contains native code, you'll want to check the Native check box in the list as well (you can debug both managed and native code at the same time).
In the Available Processes list box, find the xdesproc.exe that corresponds to your project and click Attach.
If there are multiple processes (usually because you have multiple projects open or because the designer is reloading or has recently reloaded), it can be difficult to determine which designer process belongs to which Visual Studio instance. It's often easiest just to attach to all of them. A tool like Process Explorer can help you figure out which designer process belongs to which instance of Visual Studio.
Note: Do not attach the debugger to a designer process (xdesproc) that belongs to the same instance of Visual Studio that you are using for debugging: doing so is likely to cause Visual Studio to hang. You must always use two different instances of Visual Studio.
Do whatever you need to do to repro the bug. When it occurs, the debugger will break at the point where the exception is thrown. The debugger should load the symbols for your assemblies.
I got here while looking for info on how to debug designer time instance problems, though I did not have the same problem as rikkit. But...I'm sharing the solution to a related issue just in case others having the same problem reach here as well:
Make sure you have the "Enable/Disable Project Code" toggle set to "enabled"...in VS/Blend 2015 it's a small icon below the XAML editor
as shown here.
If it's disabled, this could be the reason your design time instance doesn't seem to be working.
Further, if it's disabled and you attempt to debug using a second VS instance, then when you attach to the XDesProc any breakpoints you set in the code-behind will report that they "will not currently be hit. [because] No symbols have been loaded for this document".
You might think that you need to somehow load the symbols, but if you open up the Modules window attempting to do so, you won't even see your module in the listing.
I lost a couple hours on this issue because of this setting being disabled. Hope this helps others not do the same.
I'm not sure about it but I believe you can check for the IsInDesignModeProperty Field. I remeber having to do so on WinForms sometimes.
Also take a look at this link Troubleshooting WPF Designer Load Failures

Conditionally control the visibility of a background image in a .NET report (rdlc)

Quick Summary: How can I conditionally control (at run-time) the visibility of a background image in a report using the built in .rdlc report capabilities in .NET (I am using VB).
The Story:
I have a system that creates "certificates". The certificates are created based on a report definition (.rdlc) and displayed as PDF's to the user, they never see the report viewer control. This system has a public test site as well as the live production site. We want to place a water mark image on any of the certificates that are created by the test system. Basically because we don't want someone creating a test certificate and passing it off as a real one. There is a system level flag that is true when the site runs in test mode, I would like to trigger the visibility of the background image that is a watermark ONLY when that variable is TRUE. At this time I am able to pass a report parameter with this test mode variable, but can't find a way to trigger the visibility of the background image.
Please let me know if any more information is need or further clarification.
Thanks.
Well, I figured it out quicker than I expected. The trick in this case was to use an Expression for the BackgroundImage property's value (the source is set to Embedded). In my case it looked something like this:
=iif(Parameters!ShowTestWaterMark.Value, "WatermarkVoid1", nothing)
Where Parameters!ShowTestWaterMark.Value is the parameter of True or False, and the "WatermarkVoid1" was the name of the embedded image.
While this doesn't directly toggle the visibility of the image, it does meet my requirements to only have the image shown in a specific case.