Translucent intellisense, when technology obscures your code ;)

by dsandor 7. February 2010 18:57

Blankenburg posted this on Friday.  Very cool thing and I never even knew about it.  Often times I am coding and am inserting a line of code above some existing code.  Many times the two are related and I need to see the line below but Intellisense covered it up.  Drat.  Press the left control key and it will get out of your way!

http://jeffblankenburg.com/2010/02/5th-of-diduary-did-you-know-you-can.aspx

 

Tags: , ,

Programming | Visual Studio

My Fix: Unknown build error, 'Cannot resolve dependency to assembly…

by dsandor 3. February 2010 18:19

image

This work around did not work for me.  I have a solution with several projects.  One of them is a WPF application that uses a Telerik third party control for the DataGrid.  Yesterday everything worked fine and this morning I came in to work and I get the error:

Error    3    Unknown build error, 'Cannot resolve dependency to assembly 'Telerik.Windows.Controls, Version=2009.3.1314.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. Line 12 Position 10.'     D:\Projects\RFID\Source\RFID\Client\RFID.Client.UI\View\IdleView.xaml    12    10    RFID.Client.UI

No checkouts or get latest was performed.  Restarted VS2010 did not work. 

In my case the work around was to add the Telerik.Windows.Controls assembly to the project references manually.  This should have been done by the drag/drop of the Telerik control to the design surface but it did not.  Other issues were reported on connect.microsoft.com explaining that assemblies with a 2nd degree of separation which are not normally required to be directly referenced are now needed in VS2010 for whatever reason.

Tags: , , ,

WPF | Visual Studio | Programming

Sweet, my VS 2010 B2 bug was fixed! Thanks VS Dev Team!

by dsandor 13. December 2009 03:31

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=505636

I am developing a silverlight application that is using a WCF service in my local solution. When I right click on the service reference in the SL application and choose update or if I click configure a duplicate Endpoint and Bindings for the service in my ServiceReferences.ClientConfig file:
     <endpoint address="http://localhost:15153/AdminService.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IAdminService" contract="Proxy.AdminService.IAdminService"
        name="BasicHttpBinding_IAdminService" />
     <endpoint address="http://localhost:15153/AdminService.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IAdminService1" contract="Proxy.AdminService.IAdminService"
        name="BasicHttpBinding_IAdminService1" />

Posted by Microsoft on 11/16/2009 at 2:52 PM

Dear Customer,
Thanks for reporting the issue.
This issue has been resolved in the latest version of Visual Studio 2010.
Thanks!

Tags:

Programming | Visual Studio | Silverlight

Free open source screen to movie capture application.

by dsandor 13. December 2009 03:26

I have used this before and had to search for it again.  This is a great little application that will allow you to define a region of your screen and it will record a video to .avi or .swf.  It has a bunch of cool features like auto-pan, support for audio, etc.

http://sourceforge.net/projects/camstudio/

Very useful for making tutorials and video casts for your blog.. hint hint ;)

 

Tags: , ,

Programming

Solved: Custom tool warning: No endpoints compatible with Silverlight 3 were found.

by dsandor 12. December 2009 04:30

Warning    7    Custom tool warning: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.    D:\Projects\VMR\AzureVMR\VMRSilverlight\Service References\Proxy.DataService\Reference.svcmap    1    1    VMRSilverlight

Visual Studio 2010 Beta 2 has been giving me some funky errors lately.  The errors occur out of the blue.  Updating the service references work find for a few days and then seemingly at random I start to get the error above.

I found a solution that has been working for me.

Reconfigure the service reference:

image

Check the box “Reuse types in referenced assemblies” and choose “Reuse types in specified referenced assemblies”  Choose only the Model assemblies that you share between the Silverlight App and your WCF Service.  Hit OK and you should be good to go!

Tags:

Silverlight | Programming | Visual Studio | WCF

Solved: Cannot find 'ServiceReferences.ClientConfig' in the .xap application package.

by dsandor 8. December 2009 22:45

I started receiving this error after I added some code to my App.xaml.cs file.

image

 

After some searching I found some outdated info.  Basically this is a timing issue.  I inserted this code in my App.xaml.cs file:

   1: SFA.SLApplication.Proxies.DataServiceClient dataSvc = new SFA.SLApplication.Proxies.DataServiceClient();
   2:  
   3: public App()
   4: {
   5:     this.Startup += this.Application_Startup;
   6:     this.Exit += this.Application_Exit;
   7:     this.UnhandledException += this.Application_UnhandledException;
   8:  
   9:     InitializeComponent();
  10: }
  11:  
  12: private void Application_Startup(object sender, StartupEventArgs e)
  13: {
  14:     this.RootVisual = new MainPage();
  15:  
  16:     dataSvc.GetUsersAllCompleted += new EventHandler<SFA.SLApplication.Proxies.GetUsersAllCompletedEventArgs>(dataSvc_GetUsersAllCompleted);
  17:     dataSvc.GetUsersAllAsync();
  18: }

So the problem is with line #1.  This line is trying to read from the ServiceReferences.config file that can not be read at that point in the Silverlight application’s lifecycle.  Changing the code like this works:

   1: SFA.SLApplication.Proxies.DataServiceClient dataSvc = null;
   2:  
   3:  public App()
   4:  {
   5:      this.Startup += this.Application_Startup;
   6:      this.Exit += this.Application_Exit;
   7:      this.UnhandledException += this.Application_UnhandledException;
   8:  
   9:      InitializeComponent();
  10:  }
  11:  
  12:  private void Application_Startup(object sender, StartupEventArgs e)
  13:  {
  14:      this.RootVisual = new MainPage();
  15:  
  16:      dataSvc = new SFA.SLApplication.Proxies.DataServiceClient();
  17:  
  18:      dataSvc.GetUsersAllCompleted += new EventHandler<SFA.SLApplication.Proxies.GetUsersAllCompletedEventArgs>(dataSvc_GetUsersAllCompleted);
  19:      dataSvc.GetUsersAllAsync();
  20:  }

Hope this helps someone ;)

 

 

 

Full error below:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; InfoPath.3)
Timestamp: Tue, 8 Dec 2009 18:19:34 UTC

Message: Unhandled Error in Silverlight 3 Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.InvalidOperationException: Cannot find 'ServiceReferences.ClientConfig' in the .xap application package. This file is used to configure client proxies for web services, and allows the application to locate the services it needs. Either include this file in the application package, or modify your code to use a client proxy constructor that specifies the service address and binding explicitly. Please see inner exception for details. ---> System.Xml.XmlException: Cannot open 'ServiceReferences.ClientConfig'. The Uri parameter must be a relative path pointing to content inside the Silverlight application's XAP package. If you need to load content from an arbitrary Uri, please see the documentation on Loading XML content using WebClient/HttpWebRequest. ---> System.ArgumentException: Application object is not initialized.
   at System.Windows.Application.GetResourceStream(Uri uriResource)
   at MS.Internal.JoltHelper.ApplicationResourceStreamResolver.GetApplicationResourceStream(Uri relativeUri)
   at System.Xml.XmlXapResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   --- End of inner exception stack trace ---
   at System.Xml.XmlXapResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings)
   at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()
   --- End of inner exception stack trace ---
   at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()
   at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Current()
   at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
   at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
   at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
   at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)
   at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
   at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
   at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
   at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
   at System.ServiceModel.ClientBase`1..ctor()
   at SFA.SLApplication.Proxies.DataServiceClient..ctor()
   at SFA_SLApplication.App..ctor()    

Line: 56
Char: 13
Code: 0
URI: http://localhost:26140/SFA.SLApplicationSite/

Tags: , ,

Silverlight | Programming | WCF

How to implement a waiting or loading animation in Silverlight 3 in less than 5 minutes from scratch.

by dsandor 6. December 2009 19:37

Loading data into your Silverlight Line of Business application can take a second or two.  Sometimes it is necessary to pacify the user with a ‘Waiting’ or ‘Loading’ screen reminiscent of the AJAX Loading panels from days past in ASP.NET.

I Googled for some solutions and found some really bad code and over engineered solutions.  I like simplicity so here it is in a nutshell:

  1. Add a child window to your project.
  2. Remove the ‘Chrome’ from the child window template so there is no ‘Titlebar’ on the child window.
  3. Add a Textblock and a ProgressBar Control to the child window (resize the window also, 180 x 80 is what I use).
  4. Set the ProgressBar Control’s IsIndeterminate property to True.

That is basically your ‘Waiting window’.  The ProgressBar self animates so you don’t need to deal with that.  You can go so far as to add a property to the code behind that will allow you to set the loading message dynamically.

Open the child window when you want to display the message and close it when you are done.  I have an event that fires in my ViewModel class that tells me when my data is loaded.  So before I have the View ask for the data from the ViewModel I show the waiting window.  Then the ViewModel fires a ‘DataLoaded’ event which the View subscribes to.  The View then closes the waiting window.  *NOTE* XAML Binding purists will hate this.  So if you are one go ahead and create some data bindings in your View’s XAML and accomplish the Open and Close of the waiting window on your own.

image

My code behind becomes this:

   1: public partial class QuoteView : Page
   2: {
   3:     ViewModel.QuoteEditViewModel viewModel = new ViewModel.QuoteEditViewModel();
   4:     View.Popup.WaitingView waiting = new Popup.WaitingView();
   5:  
   6:     public QuoteView()
   7:     {
   8:         waiting.Message = "Loading quote...";
   9:         waiting.Show();
  10:  
  11:         viewModel.QuoteLoaded += new EventHandler(viewModel_QuoteLoaded);
  12:         viewModel.LoadQuote(ViewModel.State.CurrentQuote.QuoteID);
  13:         this.DataContext    = viewModel;
  14:  
  15:         InitializeComponent();
  16:     }
  17:  
  18:     void viewModel_QuoteLoaded(object sender, EventArgs e)
  19:     {
  20:         waiting.Close();
  21:     }
  22:  
  23:     // Executes when the user navigates to this page.
  24:     protected override void OnNavigatedTo(NavigationEventArgs e)
  25:     {
  26:     }
  27:  
  28: }

There is ZERO code in the Waiting Child Window.

Line 3 creates an instance of my ViewModel.  That class is responsible for retrieving the data for the form and setting the data properties on itself with the data it retrieves.  After it retrieves the data it fires an event called QuoteLoaded.

Line 4 creates an instance of the Waiting child window.

Line 8 sets my message above the progressbar control.

Line 9 shows the waiting window.

Line 20 closes the waiting window when the data is all loaded.

Easy-peasy!

Tags: , , ,

Silverlight | Programming

Business Cable Modem speeds see decent now that my line has been conditioned.

by dsandor 6. December 2009 19:36

image

Tags:

How to add a new Silverlight Application to an existing Website project in Visual Studio 2010 B2 (so when the Silverlight application is built the .XAP file is automatically copied to the Website).

by dsandor 1. December 2009 19:54

In Visual Studio 2010 B2 this is really easy.

Simply right click on your Website project root and choose Property Pages.

image

Click the Silverlight Applications option.  Here you can select the Silverlight Application project from the drop down and specify the destination folder for the .XAP file once it is built.

Tags:

Solved: Can not (F5) run Silverlight 3 application from Blend 3 when the Silverlight application is created via Visual Studio 2010 Beta 2.

by dsandor 1. December 2009 19:30

The “Microsoft.WebApplication.Build.Tasks.GetSilverlightItemsFromProperty” task could not be loaded from the assembly … Microsoft.WebApplication.Build.Tasks.dll. … The assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.  Confirm that the <UsingTaskk> declaration is correct, and that the assembly and all its dependencies are available.

So I am sure there is a way to tweak / edit the solution files and .csproj files to fix this.  I had not gotten into much coding with the Silverlight side of this solution.  I had been working on the Model and WCF stuff (targeting .NET 4.0) so I encountered this when I started on some ViewModel code. 

Clearly this is because the WebApplication project created for the Silverlight 3 application is trying to build with the .NET 4.0 version of the MSBuild environment and Blend 3 wants the 3.5/2.0 version.

The simplest way to fix this is to create the Silverlight + Website project from Blend 3.  Then Add the projects to your VS 2010 B2 solution.  Then everything works.

image

 

image

Other Pages

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010 David Sandor