Solved: Unrecognized attribute ‘multipleSiteBindingsEnabled’. with .NET 4.0 Beta 2 and RC1.

by dsandor 15. February 2010 22:59

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'multipleSiteBindingsEnabled'. Note that attribute names are case-sensitive.
Source Error:

Line 105:  -->
Line 106:	<system.serviceModel>
Line 107:		<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Line 108:  <services>
Line 109:			<service behaviorConfiguration="RFID.Server.WCF.Service1Behavior" 
name="RFID.Server.WCF.Service1">

Source File: C:\inetpub\web\services.test.\RFIDServer\web.config    Line: 107


Version Information: Microsoft .NET Framework Version:4.0.21006; ASP.NET Version:4.0.21006.1


Received the above error message when executing a WCF service on a test server.  The WCF service was compiled with .NET  4.0 RC and the test server only had .NET 4.0 Beta 2 installed.  The fix was easy.  Install .NET 4.0 RC full runtime on the test server and it worked.

Tags: , , , , ,

WCF | Visual Studio | Programming

Visual Studio 2010 RC - ObservableCollection<> is no longer available..

by dsandor 10. February 2010 19:25

From VS2010 Beta 2 to VS2010 RC we lost the ability to choose the data type ObservableCollection when configuring a service reference in a Silverlight application.  I am going to use this blog post to chronicle my discussion with Microsoft Go-Live support about this functionality change.

---

This may be a user education issue but the difference is significant and affects all of the production projects we currently have for Visual Studio 2010 Beta 2.

Today we upgraded 3 of our developer machines from Visual Studio 2010 Beta 2 to the Visual Studio 2010 RC.  In beta 2 when adding a Service Reference to a Silverlight 3 application we were given the option to choose a collection type of: System.Collections.ObjectModel.ObservableCollection in the Collection type drop down box.

clip_image002

Now in the release candidate we are no longer given the option to choose ObservableCollection.  Instead the dropdown offers ( Custom ), Array, Generic List (and another).  This presents us with several issues.  Existing Beta 2 code can no longer update service references without converting all return types from Array[] or List<> to an ObservableCollection. 

For Silverlight applications this is pretty major as we pass Generic Lists from our WCF service and heavily relied on the ability for the WCF Proxy class to deserialize the list into an ObservableCollection since these are bindable directly to our Silverlight grids.

Please advise.  Is this the way this will work in production or is it possible to patch the RC to provide this functionality once again.

Please feel free to call me tomorrow ( 2/10/2010 ) from 9AM EST to 8PM EST to discuss if you need more information.  It has been a while since I used Visual Studio 2008, but I am pretty sure that VS 2008 also provided the ObservableCollection collection type option when configuring a service reference.

To verify the Beta 2 vs. RC functionality difference I tested this against the same exact WCF service in both B2 and RC.

Tags: , , ,

Silverlight | Visual Studio | WCF

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

Writing Silverlight 3 applications while reusing your Domain Objects / Data Contracts / Business Objects for ASP.NET and WPF and MVVM via WCF.

by dsandor 17. October 2009 20:08

Please note that I am still tweaking this article, I just wanted to publish it quickly because I have had a lot of questions from other developers concerning this very topic.  I will remove this note when the article is complete and I will provide a link to a project that implements this functionality from DB –> L2S –> WCF –> Model –> WPF and Silverlight.


I hope that subject was descriptive enough.  Here is the problem:  You are developing applications using an MVVM and want to use your Model code for WPF applications and Silverlight.  You will quickly find that you need to build your Model and ViewModel in a Silverlight targeted assembly.  Many people actually add the Model and ViewModel class files in the Silverlight project file.  That is a) nasty and b) you can not use your model as your data contract for your WCF service.

The solution I found was very simple.  Create your WCF service and use your Model classes as data contracts.  Now your Model classes will all be decorated with DataContract and DataMember attributes.  These are not compatible with Silverlight so you need a solution for this part of the problem.  In short, you need to conditionally compile out the non-Silverlight compatible attributes (yes it is a bit ugly in code, but it saves you a lot of time and it works!).

Example

So lets walk through a simple application that lists Employee records from a database.  The architecture looks like this:

MVVM-Silverlight

There are a lot of lines there but we will focus on the Silverlight side of things.  The goal is to create one Model class that is shared between the WCF service and the Silverlight application.  This Model class should also be able to be used by WPF applications (and ASP.NET) as well.  I will call the procedure for making the Model work across both architectures Portable Model or pModel. 

Linq / SQL Metal / ADO.NET Entity Framework Objects

Use one of these technologies to get your data from the database into an object.  These objects should NOT (and can not) be passed around through to Silverlight application.  The solution is to use a Portable Model.  In this example I used SQL Metal to generate out a Data Context for my database which has an Employee table.

image

WCF

At my WCF tier I want to perform the following:

  • Query the database and get all the Employees.
  • Convert the DataContext / SQL Metal / Linq objects to a Model object.
  • Send the Model object down the wire to the client.

Traditionally this can be done without issue for WPF applications.  This is because both types of applications are running the full blown CLR.  They can share the same DLL and the WCF proxy will nicely convert the WCF message from the wire into a well typed Model object.

* A note about sending EF or Data Context objects down the wire.  While this will work, technically, if your client uses the full CLR (WPF / ASP.NET), it is highly discouraged.  Take a SQL Metal Data Context object for example.  When you send that type of object down to the client it actually has the ability to talk directly to the database bypassing your WCF layer (and any business logic you should have in your Model or Business Entity code).  Your tiering breaks down at this point your you break many good development practices.

When you throw Silverlight into the mix, the problem becomes a matter of CLR mismatch.  Your traditional Model class that you are sharing between the client and WCF service is built against the full CLR so you can not add the reference to your Silverlight application.  You could use the proxy generated code in the Silverlight application but this really breaks some of MVVM.

Take your ‘Employee’ Model code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
 
namespace VMR.Model
{
 
 
    [DataContract]
    public class Employee : System.ComponentModel.INotifyPropertyChanged
    {
        public Employee() { }
 
 
        private int _EmployeeID;
        
        [DataMember]
        
        public int EmployeeID
        {
            get { return _EmployeeID; }
            set 
            { 
                _EmployeeID = value;
                SafeNotify("EmployeeID");
            }
        }
 
        
 
        private string _Username;
        
        [DataMember]
        public string Username
        {
            get { return _Username; }
            set
            {
                _Username = value;
                SafeNotify("Username");
            }
        }
 
        private string _FirstName;
        
        [DataMember]
        public string FirstName
        {
            get { return _FirstName; }
            set
            {
                _FirstName = value;
                SafeNotify("FirstName");
            }
        }
 
        private string _LastName;
        [DataMember]
        
        public string LastName
        {
            get { return _LastName; }
            set
            {
                _LastName = value;
                SafeNotify("LastName");
            }
        }
 
        private string _Password;
        
        [DataMember]
        public string Password
        {
            get { return _Password; }
            set
            {
                _Password = value;
                SafeNotify("Password");
            }
        }
 
        private bool _CanUserLogin;
        
        [DataMember]
        public bool CanUserLogin
        {
            get { return _CanUserLogin; }
            set
            {
                _CanUserLogin = value;
                SafeNotify("CanUserLogin");
            }
        }
 
        private string _EmailAddress;
        
        [DataMember]
        public string EmailAddress
        {
            get { return _EmailAddress; }
            set
            {
                _EmailAddress = value;
                SafeNotify("EmailAddress");
            }
        }
 
        private string _PhoneNumber;
        
        [DataMember]
        public string PhoneNumber
        {
            get { return _PhoneNumber; }
            set
            {
                _PhoneNumber = value;
                SafeNotify("PhoneNumber");
            }
        }
 
 
        #region INotifyPropertyChanged Members
 
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
 
        #endregion
 
        private void SafeNotify(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
        }
 
        public override string ToString()
        {
            return string.Format("{0} {1}", FirstName, LastName);
        }
    }
}

This Model will work for WCF, WPF and ASP.NET but will not work for Silverlight because the agCLR (Silverlight CLR) does not support the DataContract and DataMember attributes.  You could fake it and create a mock attribute in Silverlight but that seems like a poor architecture. 

Enter – Shared Class Files and Conditional Compilation

Visual Studio has had a cool feature for some time that lets you add a ‘Link’ to another source file in a different project.  Both projects will compile the code file and both projects can edit the code.  Physically, only one instance exists.

The Model / CLR dilemma can be solved partially by creating a new Silverlight Class Library project in your solution and adding a Link to the Model class. 

Now your linked class will not yet compile until you tell the compiler to ignore the DataContract and DataMember attributes when building for Silverlight.

You do this by wrapping your attributes in a conditional compilation statement.  This definitely  make the model code look a bit ugly, however the beauty is that now when you build your solution you will end up with a CLR and agCLR compiled version of the assembly.  There are other ways to do this with targeting and platform based builds, however, by doing it this way you can add project references to the Silverlight version of the Model and your project will be much better organized.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
 
namespace VMR.Model
{
 
#if !SILVERLIGHT
    [DataContract]
#endif
    public class Employee : System.ComponentModel.INotifyPropertyChanged
    {
        public Employee() { }
 
 
        private int _EmployeeID;
        #if !SILVERLIGHT
        [DataMember]
        #endif
        public int EmployeeID
        {
            get { return _EmployeeID; }
            set 
            { 
                _EmployeeID = value;
                SafeNotify("EmployeeID");
            }
        }
 
        
 
        private string _Username;
        #if !SILVERLIGHT
        [DataMember]
        #endif 
        public string Username
        {
            get { return _Username; }
            set
            {
                _Username = value;
                SafeNotify("Username");
            }
        }

 

Below you will see the CLR Model (VMR.Model project) and the agCLR Model (VMR.Silverlight.Model project).

image

How do you add one of the Model class code files as a link to the Silverlight Class Library project?

image

Like normal, add an Existing Item to the Silverlight.Model assembly.  Locate the normal Model class on the disk.

image

Click the down arrow next to the Add button and choose Add As Link. 

Now you have one source for both your CLR (WPF) and agCLR (Silverlight) Model code.  By doing this the namespaces are the same and message deserialization is transparent on both platforms.  You can now use your ViewModel (your view model will need to be different for WPF and Silverlight because it will need to reference the platform specific version of the model) in your client code to retrieve the Model data and bind it to the XAML in your WPF or Silverlight application.

Tags: , , , , , ,

Programming | Silverlight | WCF | WPF | Visual Studio

Debugging Silverlight 3 and WCF - The remote server returned an error: NotFound.

by dsandor 4. October 2009 06:35

So here is the skinny:  Your WCF service blew up and that was the extent of your error.

Solution: Figure out why your WCF service blew up.

Some possible solutions:

You are returning too much data and your service config is causing the problem:

http://betaforums.silverlight.net/forums/t/126267.aspx

Increase your array length or your data length.

You are querying a WCF service cross domain (yes if your wcf service is hosted in Cassini you need to have a correct cross domain policy).

http://msdn.microsoft.com/en-us/magazine/cc794260.aspx

I use this for my development server / Cassini:

ClientAccessPolicy.xml


<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource include-subpaths="true" path="/"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

You are serializing an Enum and failed to decorate the Enum Values with the EnumMemberAttribute.

http://msdn.microsoft.com/en-us/library/system.runtime.serialization.enummemberattribute.aspx

 

Still stuck? Turn on tracing and your stack trace will show the true error. (THIS WORKS!!)

http://blogs.msdn.com/madhuponduru/archive/2006/05/18/601458.aspx

Test your service with the WcfTestClient that comes with visual studio.

This will allow you to call the WCF service with a simple little tool.  The GUI allows you to double click on a WCF method and provide the parameters for the method.  The app calls the WCF service and reports the stack trace.

The GUI app is found here on 64 bit computers:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe

and here on 32 bit machines:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe

What is being sent to my WCF service or what is being sent or received by my Silverlight application?

http://projects.nikhilk.net/WebDevHelper

Note:  This tool is VERY good for checking security on your Silverlight application.  I recently heard a company was hacked because they transmitted state information via XML to a server.  The user used an app like this or Fiddler to see the communication between the server and the browser and modified the response.  They stole a lot of $ by doing this.  Be WARNED!  Users are getting a lot smarter, do not assume your XML traffic is safe.

Tags: , , , ,

Programming | Silverlight | WCF | WPF | Visual Studio

Workaround: The configuration for the service…Unrecognized element ‘extendedProtectionPolicy’.

by dsandor 11. September 2009 07:11

The configuration for the service reference could not be updated due to the following issue: Unrecognized element ‘extendedProtectionPolicy’. (App.config / Web.config)

image

There does not seem to be a really clear reason why this is happening however it seems to be related to Windows 7.  I am not sure if the .NET framework that ships with Win7 has some different setting or template for the WCF configuration policy files but it seems to be the culprit.  Maybe the machine.config files are different on Win 7 and the WCF configuration tools use the machine.config as some sort of policy template.

The fix is annoying (because every time you build your solution on Windows 7 and then rebuild on Vista you have to redo this).

Remove the line:

<extendedProtectionPolicy policyEnforcement="Never" />

from both your App/Web.config file on the client and on the WCF server’s Web.config file.

 

 

Tags: , ,

WCF | Visual Studio | Programming

Solved: Unable to automatically step into the server. The remote procedure could not be debugged…

by dsandor 16. August 2009 23:51

I started having this problem with one of my applications that connects to a WCF service I was debugging at home.  Plenty of posts exist telling you to make sure there is a <system.web><compilation debug=”true:” /></system.web> entry in your web.config. 

Well for most people that works but I learned that trick 9 years ago when Web Services first came on the scene.  This was clearly different.

As it turns out the problem is related to the x64 debugging toolset (or the lack-thereof in Visual Studio 2008 et al).

image

The solution was simple.  In the consuming application change the target CPU from Any CPU or x64 to x86.

 

Bad setting:

image

Good Setting:

image

Now you can step into your WCF service.  Also, you should start campaigning to get a 64 bit version of Visual Studio 2010…etc.  Microsoft’s Visual Studio development teams seems to think that it is an unnecessary feature.  I beg to differ.

Tags: , , , , ,

Visual Studio | WCF | Programming

The InnerException message was 'Type 'System. DelegateSerializationHolder +DelegateEntry' with data contract name 'DelegateSerializationHolder. DelegateEntry :http://schemas. datacontract.org /2004/07/ System' is not expected.

by dsandor 17. July 2009 00:17

In .NET 4.0 / Visual Studio 2010 I was working with a WPF application who’s ViewModel was sending a Model (Data) object back to a WCF service for processing.  In previous versions of the framework and WCF I could simply send any serializable object down the wire.  In .NET 4.0 apparently I need to do some further class decorating.

I needed to include the namespace:

using System.Runtime.Serialization;

My class that I was sending needed to be decorated with:

[DataContract]

and the properties I wanted to send down the wire via WCF needed to have:

[DataMember]

After decorating the Class and it’s properties with DataContract and DataMethod everything worked like a charm.

 

Below are some of the debugger data that helped troubleshoot the problem.

error

 

The InnerException message was 'Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected.

System.ServiceModel.CommunicationException was unhandled
  Message=There was an error while trying to serialize parameter http://tempuri.org/:receipts. The InnerException message was 'Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.
  Source=mscorlib
  StackTrace:
    Server stack trace:
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter writer, PartInfo part, Object graph)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameter(XmlDictionaryWriter writer, PartInfo part, Object graph)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameters(XmlDictionaryWriter writer, PartInfo[] parts, Object[] parameters)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter writer, MessageVersion version, Object[] parameters, Object returnValue, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Security.SecurityAppliedMessage.WriteBodyToSignThenEncryptWithFragments(Stream stream, Boolean includeComments, String[] inclusivePrefixes, EncryptedData encryptedData, SymmetricAlgorithm algorithm, XmlDictionaryWriter writer)
       at System.ServiceModel.Security.WSSecurityOneDotZeroSendSecurityHeader.ApplyBodySecurity(XmlDictionaryWriter writer, IPrefixGenerator prefixGenerator)
       at System.ServiceModel.Security.SecurityAppliedMessage.OnWriteMessage(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
       at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
       at System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)
       at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Warehouse.ViewModel.Services.SyncService.ISync.SendNewReceipts(SendNewReceiptsRequest request)
       at Warehouse.ViewModel.Services.SyncService.SyncClient.SendNewReceipts(SendNewReceiptsRequest request) in d:\Projects\Warehouse.2010\Warehouse.ViewModel\Service References\Services.SyncService\Reference.cs:line 75
       at Warehouse.ViewModel.SyncData.PerformSync() in d:\Projects\Warehouse.2010\Warehouse.ViewModel\SyncData.cs:line 60
       at Warehouse.Window1.btnBackup_Click(Object sender, RoutedEventArgs e) in d:\Projects\Warehouse.2010\Warehouse\Window1.xaml.cs:line 196
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at Warehouse.App.Main() in d:\Projects\Warehouse.2010\Warehouse\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Runtime.Serialization.SerializationException
       Message=Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
       Source=System.Runtime.Serialization
       StackTrace:
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteSerializationInfo(XmlWriterDelegator xmlWriter, Type objType, SerializationInfo serInfo)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteISerializable(XmlWriterDelegator xmlWriter, ISerializable obj)
            at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
            at WriteDockReceiptToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
            at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
            at WriteArrayOfDockReceiptToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
            at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
            at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph)
            at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph)
            at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph)
            at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter writer, PartInfo part, Object graph)
       InnerException:

 

 

Tags: , , ,

WCF | WPF

AG_E_UNKNOWN_ERROR inside Silverlight/WPF project

by dsandor 17. July 2009 00:13

I encountered the infamous AG_E_UNKNOWN yesterday.  I was actually using Silverlight controls from Telerik.  I dragged the RadGridView control inside my XAML and thats where the problem manifested.  Apparently the drag/drop operation did not add all the References that I needed in order to use the Telerik controls. 

If you have the same problem, make sure all the references and dependencies are referenced in your project’s References section.  I had to add Telerik.Windows.Controls and Telerik.Windows.Controls.Data to get my RadGrid error in my XAML to go away.

Tags: ,

WCF | WPF | Programming | Silverlight

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