文章目录
  1. 1. 2016-5-16
    1. 1.1. Dependency check(restriction) of csproj
  2. 2. 2016-5-12
    1. 2.1. AssemblyVersion vs FileVersion vs ProductVersion
    2. 2.2. Error raised by xaml: does not have a resource identifier by the uri
    3. 2.3. Error xceed.wpf.toolkit.aerolite in xaml when use xceed
    4. 2.4. LoadFile vs LoadFrom in Assembly
    5. 2.5. Dynamic Module(Assembly)?
  3. 3. 2016-5-11
    1. 3.1. Task.Run is not available and error doesn't contain a definition for 'GetAwaiter' in Task.Factory.StartNew
    2. 3.2. async WPF click event for CPU intensive operation
    3. 3.3. async linq?
    4. 3.4. Side effects of [Serializable]
    5. 3.5. Caliburn.Micro PropertyChangedBase not Serializable. (Even mark as Serializable who inherit it)
    6. 3.6. Cannot be Serializable who implement INotifyPropertyChanged
    7. 3.7. Performance: AppDomain vs Process
  4. 4. 2016-5-9
    1. 4.1. Ignore first time SelectionChanged event
  5. 5. 2016-5-4
    1. 5.1. shortcut to navigate in Peek Definition
    2. 5.2. Annotate a file in VS2015(git blame)
  6. 6. 2016-4-29
    1. 6.1. Select-All design pattern with post-selection events (single or multiple confirmation)
  7. 7. 2016-4-27
    1. 7.1. How to add strong name to dll(sign a dll)?
  8. 8. 2016-4-25
    1. 8.1. protected internal in C#?
    2. 8.2. Unit test DateTime.Now
    3. 8.3. Set value of internal/private fields/properties via dynamic
    4. 8.4. Error CS0656 after used dynamic
  9. 9. 2016-4-24
    1. 9.1. image comments in VS2015
    2. 9.2. should I sign my extension before uploading to VS gallery?
    3. 9.3. what if I want to sign my extension for VS?
    4. 9.4. debug VS2015 extension project
  10. 10. No Answer Questions
    1. 10.1. VsVim shortcut key missing in option
    2. 10.2. WPF Error: Cannot find governing FrameworkElement or FrameworkContentElement for target element
    3. 10.3. Count IEnumerable without knowing T
    4. 10.4. UWP with MVVM
    5. 10.5. How to restrict team member misuse IoC?

2016-5-16

Dependency check(restriction) of csproj

  1. still cannot achieved by using code anlysis
  2. use .Net Architecture Checker

2016-5-12

AssemblyVersion vs FileVersion vs ProductVersion

  • AssemblyVersion is used for assembly reference.
  • FileVersion is used for mark which build the assembly produced.
  • ProductVersion is used for marketing, not used in program.

eg, version of mscorlib 2.0.0.0

  • AssemblyVersion: 2.0.0.0
  • FileVersion: 2.0.50727.3521
  • ProductVersion: 2.0.50727.3521

Error raised by xaml: does not have a resource identifier by the uri

Scenario is when try to load two different version of assemblies.(same code with different Assembly Version)

It’s limitation to Xaml generator. Workaround:

  1. put <AssemblyVersion> in .csproj file.
  2. use build parameter.

Error xceed.wpf.toolkit.aerolite in xaml when use xceed

Ignore it, as it’s internal mechanism to try to load it.

LoadFile vs LoadFrom in Assembly

  • LoadFrom, default action when .Net load assembly, load only once for same identity even in two location with different meta data.
  • LoadFile, load exactly what was requested, and would not load dependency.

Dynamic Module(Assembly)?

Use AssemblyBuilder

2016-5-11

Task.Run is not available and error doesn't contain a definition for 'GetAwaiter' in Task.Factory.StartNew

Task.Run is available since .Net 4.5 and this error would disappear after switched target to 4.5

async WPF click event for CPU intensive operation

Lesson learned:

  1. Don’t use async/await in .Net 4.0.
  2. Use Task.Run to replace the CPU intensive code.
  3. Need to manually fire PropertyChanged event for ViewModel.

async linq?

In a word, linq was not designed to be asynced.

Side effects of [Serializable]

No, because it’s Attribute which only read by some program runtime.

Caliburn.Micro PropertyChangedBase not Serializable. (Even mark as Serializable who inherit it)

It marks with [DataContract], maybe mark field with [DataMember] can fix this(not test).

Cannot be Serializable who implement INotifyPropertyChanged

Because the event, change it to:

1
2
[field:NonSerializable]
public event ChangedEventHandler PropertyChanged;

Performance: AppDomain vs Process

No comparison found, however, obviously AppDomain should be much faster than process which not involving a lot of system resource allocation.

2016-5-9

Ignore first time SelectionChanged event

  1. use variable to lock
  2. use Loaded event to wire SelectionChanged event.

2016-5-4

shortcut to navigate in Peek Definition

  • Shift+Esc: Jump Between
  • Ctrl+Alt+[-/+]: Navigate between definition window
  • [Shift+]F8: navigate between multiple results

Annotate a file in VS2015(git blame)

Right click file in solution, Annotate

2016-4-29

Select-All design pattern with post-selection events (single or multiple confirmation)

Differentiate Select-All and Single-Select by event source/args.

2016-4-27

How to add strong name to dll(sign a dll)?

1
2
ildasm.exe xxx.dll /out:xxx.il
ilasm.exe xxx.il /dll /key=xxx.snk /output=xxx-signed.dll

2016-4-25

protected internal in C#?

protected internal means protected OR internal. In order to make it protected AND internal, mark parent as internal

Unit test DateTime.Now

Only way is use agent.

Set value of internal/private fields/properties via dynamic

It’s impossible to set value through dynamic, instead, use reflection with BindingFlags.Instance | BindingFlags.NonPublic

Error CS0656 after used dynamic

Need to reference Microsoft.CSharp

2016-4-24

image comments in VS2015

no stable extension so far, only available one is https://github.com/lukesdm/image-comments without maintenance for years

No, many famous extension didn’t sign itself.

what if I want to sign my extension for VS?

Here is the tutorial: http://www.jeff.wilcox.name/2010/03/vsixcodesigning/

debug VS2015 extension project

  1. Right click on the project and select Properties
  2. Go to the Debug Tab
  3. Click on the radio button for Start External Program. Point it to the devenv.exe binary. On my machine it’s located at C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe On a non x64 machine though you can remove the “ (x86)” portion.
  4. Then set the command line arguments to /rootsuffix Exp

Link

No Answer Questions

VsVim shortcut key missing in option

No answer found so far on the internet.

WPF Error: Cannot find governing FrameworkElement or FrameworkContentElement for target element

DataGrid do not inherit DataContext, need to use dummyElement and reference it by ElementName.

However, if we want to bind/use property of ItemsSource, so far, no way.

Count IEnumerable<T> without knowing T

no answer, maybe it’s impossible.

UWP with MVVM

Not fully searched, possible resources:

How to restrict team member misuse IoC?

文章目录
  1. 1. 2016-5-16
    1. 1.1. Dependency check(restriction) of csproj
  2. 2. 2016-5-12
    1. 2.1. AssemblyVersion vs FileVersion vs ProductVersion
    2. 2.2. Error raised by xaml: does not have a resource identifier by the uri
    3. 2.3. Error xceed.wpf.toolkit.aerolite in xaml when use xceed
    4. 2.4. LoadFile vs LoadFrom in Assembly
    5. 2.5. Dynamic Module(Assembly)?
  3. 3. 2016-5-11
    1. 3.1. Task.Run is not available and error doesn't contain a definition for 'GetAwaiter' in Task.Factory.StartNew
    2. 3.2. async WPF click event for CPU intensive operation
    3. 3.3. async linq?
    4. 3.4. Side effects of [Serializable]
    5. 3.5. Caliburn.Micro PropertyChangedBase not Serializable. (Even mark as Serializable who inherit it)
    6. 3.6. Cannot be Serializable who implement INotifyPropertyChanged
    7. 3.7. Performance: AppDomain vs Process
  4. 4. 2016-5-9
    1. 4.1. Ignore first time SelectionChanged event
  5. 5. 2016-5-4
    1. 5.1. shortcut to navigate in Peek Definition
    2. 5.2. Annotate a file in VS2015(git blame)
  6. 6. 2016-4-29
    1. 6.1. Select-All design pattern with post-selection events (single or multiple confirmation)
  7. 7. 2016-4-27
    1. 7.1. How to add strong name to dll(sign a dll)?
  8. 8. 2016-4-25
    1. 8.1. protected internal in C#?
    2. 8.2. Unit test DateTime.Now
    3. 8.3. Set value of internal/private fields/properties via dynamic
    4. 8.4. Error CS0656 after used dynamic
  9. 9. 2016-4-24
    1. 9.1. image comments in VS2015
    2. 9.2. should I sign my extension before uploading to VS gallery?
    3. 9.3. what if I want to sign my extension for VS?
    4. 9.4. debug VS2015 extension project
  10. 10. No Answer Questions
    1. 10.1. VsVim shortcut key missing in option
    2. 10.2. WPF Error: Cannot find governing FrameworkElement or FrameworkContentElement for target element
    3. 10.3. Count IEnumerable without knowing T
    4. 10.4. UWP with MVVM
    5. 10.5. How to restrict team member misuse IoC?