WPF problem in visual studio generated file g.vb “Namespace or type..


This warning was in the Visual Studio generated file. Warning is:

Namespace or type specified in the Imports ‘SRS.WpfControlLibrary1’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases. …SRS.WPF.Controls\obj\Debug\ucDataDrivenDGButton.g.vb 15 9 SRS.WPF.Controls

I had renamed the project and the Assembly name and the root namespace.

I did a search for the “SRS.WpfControlLibrary1” and found some required fixes/changes. Although I do not remember its creation this project used a Themes\Generic.xaml with an incorrect namespace, so I changed that.

The Generic.xaml seems to be special and in the AssemblyInfo.vb there was an attribute

<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>

I also cleaned and built the project after the Generic.xaml update and now all ok


Similar Error

With VB Project Namespace change the .g.vb file references the old namespace.


The xaml had

xmlns:my1=”clr-namespace: … old namespace

Updated this and saved (possibly build also) and the project and the problem went away




WPF datagrid takes a long time to load


myDataGrid is in a simple WPF Grid control where a RowDefinition has a Height=”*”

<Grid >
   <RowDefinition Height=”*” />

And if myDataTable has a large row count then the following may ‘hang’ or take a long time to load on following code:

myDataGrid.ItemsSource = myDataTable.DefaultView

The issue is that if the DataGrid is in a control that has unlimited height then it will render the whole DataGrid.



Options to resolve this include:

  1. Changing the RowDefinition Height
  2. Add MaxHeight to the DataGrid, so <DataGrid x:Name=”myDataGrid” MaxHeight=”1000″ />

Performance is then fine.

With thanks to: http://stackoverflow.com/questions/3336921/unreasonable-wpf-datagrid-loading-time


SQL Server – Take database offline hangs

With thanks to following and other web searches:



New SQL Server on a new Azure VM, with a few new issues to learn from. I attempted to take a database offline but it hung.


USE master

SELECT resource_type, resource_associated_entity_id,
    request_status, request_mode,request_session_id,
    FROM sys.dm_tran_locks

--Find troublesome session and kill it.
--You cannot kill your own process, so you may need to start another session

To take the database offline without waiting try this:

alter database DOTNETNUKE_EBC set offline with rollback immediate

To bring database online:

alter database DOTNETNUKE_EBC set online




Office upload center upload failed permission issue


Sometimes Office upload centre just stops working.

Sometimes with failed permission, sometimes with

“OneDrive for Business found a problem while accessing the Microsoft Office Document Cache and needs to repair it before it can continue.
As part of the repair a copy of the cache will be saved as a backup and a new cache will be created.”

See also: http://community.office365.com/en-us/f/172/t/238998.aspx on time 5/14/2014 10:58 PM

If required then:

  1. Stop syncing
  2. Rename folder as backup in case you lose files
  3. Stop related services in Task Manager Resources, including Groove, MSOSync or similar
  4. Clear cache
    http://community.office365.com/en-us/f/148/t/161576.aspxBrowse to “C:\Users\username\AppData\Local\Microsoft\Office\Spw” and delete all the content. You will see that this is all related to groove, and spw equals SharePoint Workspace.Go to “C:\Users\username\AppData\Local\Microsoft\Office\15.0\OfficeFileCache” and also delete all content from this folder. This is where all the caching from your files are stored.
    Note : Just try to delete all, if one or two items cannot be deleted, that’s OK.
  5. Sync again
    It may or may not allow you to choose a location





Loading WPF User Control at runtime

Need to place the user control in a control that accepts content. My current favourite is a “ContentControl”.

Me.ContentCanvas.Content = userControlValue
Me.ContentCanvas.Content = Nothing

Some other controls require Add.

Beware that a StackPanel will expand to fit all content, so if you put a DataGrid and possibly a ListBox in there, there will be no scroll bar.