design-time

How to debug Visual Studio 2012 instance design-time

六月ゝ 毕业季﹏ 提交于 2019-11-30 08:31:47
I'm developing a WPF MarkupExtension and encountered errors during design time. With the previous version of Visual Studio 2010 it was possible to start a second instance of Visual Studio 2010 and attach to the process of the already-running instance, setting breakpoints and debugging the design time behavior. In Visual Studio 2012 however I can attach to the process of another Visual Studio 2012 as well, but no symbols are loaded in the second instance and therefor I'm not able to debug the design time as with Visual Studio 2010. How do I get this debugger running? Things I've tried: "devenv

Design-time editor support for controls collection

杀马特。学长 韩版系。学妹 提交于 2019-11-30 07:33:47
I'd like to add a property which represents a collection of controls to a component and have a collection editor with which I can easily select the controls that belong to the collection. VS does almost what I want automatically with the following code: Private _controls As New List(Of Control) <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _ Public ReadOnly Property SelectedControls() As List(Of Control) Get Return _controls End Get End Property I get the default CollectionEditor, can add and remove controls, and the collection is serialized. The problem is that I

How to have code in the constructor that will NOT be executed at design time by Visual Studio?

吃可爱长大的小学妹 提交于 2019-11-30 07:24:47
问题 I have a method call in the constructor of my user control that does something that won't work at design time (connecting to a database), and Visual Studio just bailed out when I tried to add that control to the GUI designer. Sure, I can factor out that code to a separate method, but I don't like the idea that every time I use that object I need to remember to execute a certain method which is essential to that object's function (that's what the constructor is for!). Is there something like a

How to debug Visual Studio 2012 instance design-time

女生的网名这么多〃 提交于 2019-11-29 12:35:01
问题 I'm developing a WPF MarkupExtension and encountered errors during design time. With the previous version of Visual Studio 2010 it was possible to start a second instance of Visual Studio 2010 and attach to the process of the already-running instance, setting breakpoints and debugging the design time behavior. In Visual Studio 2012 however I can attach to the process of another Visual Studio 2012 as well, but no symbols are loaded in the second instance and therefor I'm not able to debug the

Design Time Reflection

旧时模样 提交于 2019-11-28 18:27:44
Is there a way to do reflection pre-compile - at design time? My intent is to use T4 to spit out custom codes based on classes that implement certain interfaces. I know I can call upon reflection, but I want the T4 script to spit out the additional code before compile, otherwise I will need to compile the code twice, once to generate dlls, twice to let T4 reflect on the previously generated dll and add additional scaffolding. Is there a way to do reflection at design time? Is there a better way to do this? There actually is a way of generating code pre-build based on the CodeModel provided by

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

只谈情不闲聊 提交于 2019-11-28 09:27:21
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:

Baseline snaplines in custom Winforms controls

試著忘記壹切 提交于 2019-11-28 05:18:32
I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text baseline of a control that I have exposed by my custom user control. I just had a similar need, and I solved it like this: public override IList SnapLines { get { IList snapLines = base.SnapLines; MyControl control = Control as MyControl; if (control == null) { return snapLines; }

How to see design-time data-binding in XAML editor (it works in runtime)?

落爺英雄遲暮 提交于 2019-11-27 21:08:51
I data-binded version number to appear as follows: <Window <!-- ... --> DataContext="{Binding RelativeSource={RelativeSource Self}}"> <Grid> <TextBlock> Version is: <Run Text="{Binding Version, Mode=OneWay}"></Run> and advancing... </TextBlock> </Grid> </Window> and it's working during run-time. How can I see it during design-time in the XAML editor in Visual Studio 2012 ? I only see: Version is: and advancing... instead of: Version is: 5.2.2 and advancing... EDIT - My solution: Jure's answer below works, but I ended up using a dummy view-model static code technique , which works better for me

Design Time Reflection

白昼怎懂夜的黑 提交于 2019-11-27 11:23:02
问题 Is there a way to do reflection pre-compile - at design time? My intent is to use T4 to spit out custom codes based on classes that implement certain interfaces. I know I can call upon reflection, but I want the T4 script to spit out the additional code before compile, otherwise I will need to compile the code twice, once to generate dlls, twice to let T4 reflect on the previously generated dll and add additional scaffolding. Is there a way to do reflection at design time? Is there a better

How to troubleshoot and debug Visual Studio design mode errors?

為{幸葍}努か 提交于 2019-11-27 04:39:20
Using Windows 7 and Visual Studio 2010, I am writing a C# custom UserControl. I was coding in code view for weeks and recently when I tried to switch to design mode, Visual Studio hanged, "NOT RESPONDING". I can wait for an hour, and still nothing happens. Clicking on the close button it gives the "Do you want to wait, close, restart and send information to Microsoft" dialog. Is there a way to (stack)trace the code that the designer is trying to execute? Maybe design-time trace messages or breakpoints? Blachshma For Visual Studio 2010/2013 You can debug the Visual Studio designer itself! Open