Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
I

impeham

@impeham
About
Posts
69
Topics
33
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • signalR client server stops working after DNS-ip record for server changed
    I impeham

    see my previous response for further details as i was testing it by changing the hosts file locally. the client recognizes that the server has gone down - the following event is raised by it: hubConnection.Error

    C# sysadmin question

  • signalR client server stops working after DNS-ip record for server changed
    I impeham

    i wonder if the signalR client works this way. i made a test locally - created an entry in the host file: 127.0.0.1 testaddress both the client and the server are configured to use "testaddress" as host name. when it runs, all is working well, then i change the entry to another ip address: 127.0.0.3 testaddress as expected - all is working well as the connection is still intact. now if i stop the server,wait a few seconds, then change the entry back to: 127.0.0.1 testaddress and restart the server - the connection never re-establishes - client generates errors and finally closes. these are the events raised in this scenario: hubConnection.Error - happens about 10 times hubConnection.Closed if i do the same scenario without changing the host name record (stopping the server, waiting a few seconds and restarting it), it returns to working well even if i wait a longer time - these are the events raised from the client in this case: hubConnection.Error - happens a few times until i start the server again and then hubConnection.Reconnecting hubConnection.Reconnected

    C# sysadmin question

  • signalR client server stops working after DNS-ip record for server changed
    I impeham

    I am using signalR client and service applications - both hosted as console apps. I'm interested in making the following scenario work: 1. One Service starts up at "someaddress.org" 2. Second service starts up at "172.123.2.5" 3. Client starts and creates a hub proxy to an address "someaddress.org" which points to "172.123.2.3" by the DNS server 4. Client starts to receive updates from the server 5. At some point, the server crashes and is not available anymore 6. A Health checker service detects that the service is down, and updates the DNS server to make "someaddress.org" point to "172.123.2.5" where the second (identical) service is already up At this point, the client is not able to establish connection with the new server and I'm trying to understand why and make it work. If the first service is going down and up again all is working fine, but when the DNS record changes to another server it does not work anymore. Any ideas?

    C# sysadmin question

  • LG Smart TV webos 3.0 .net framework client development
    I impeham

    i am trying to make the simplest c# application - connect to the LG TV and send a command like KEY_UP. the tv is using WEBOS 3.0 and it is possible to connect and control it using android remote when they are connected to the same network via wifi. this is an example i found on the net: LG tv app to display the list of messages - Stack Overflow[^] i tried posting the json using postman to the TV's address and it replies with "hello world". i have no idea how to pair with it in order to be able to make the command or any other command work. Have anyone done this and can point me to an example? i couldn't find one that can help with this and LG doesn't seem to have client SDK for .net.

    C# csharp tutorial android dotnet com

  • backward compatibility issues
    I impeham

    Consider the following version 1 class type (used by old clients): Public class Class1 { Public Prop1 {get;set;} Public Prop2 {get;set;} } In the new server version, a property was moved to a base class (not known to the old client): Public class BaseClass1 { Public Prop1 {get;set;} } Public class Class1 : BaseClass1 { Public Prop2 {get;set;} } "Class1" actually has the exact same structure, but the property "Prop2" is not directly held by it and moved to a base class. I tried to check the XML serialized from the new server to an old client and it seems the same, however, some properties are being serialized correctly and some aren't (the Classes demonstrated here are just an example - the true classes has many properties inside). Is such a change supported by WCF? Is there a way to bypass this problem (the old clients cannot be modified)?

    WCF and WF csharp wcf sysadmin xml help

  • wcf object serialization without datacontract/datamemember attributes strange behavior
    I impeham

    I am using .net framework wcf client and server . The signature of the WCF service interface is simple:

    ResponseMessage SendMessage(RequestMessage message)

    I create a new type that inherits from "ResponseMessage". This type holds 1 property:

    public class TestResponseMessage : ResponseMessage
    {
    public List<ISomeInterface> Members { get; set; }
    }

    According to:
    http://social.msdn.microsoft.com/Forums/en-US/72333db3-ba37-48bd-9b29-c7c60892f787/wcf-automatic-datacontract-datamember-inference?forum=netfxnetcom

    http://stackoverflow.com/questions/17616271/wcf-contracts-without-the-annotations

    It is said that "Members" property should be able to serialize without the need of the [DataContract] on the class and [DataMember] on the property, but it doesn't work - if I don't use it, I get null in the TestResponse.

    The reason for asking this is that we've encountered a very strange behavior in our product - sometimes this serialization works and sometimes it doesn't, and it seems to behave differently with same client/server versions on different machines.

    Any insights about this will be very welcome.

    C# csharp dotnet wcf com sysadmin

  • Automapper exception when converting object with inheriting members
    I impeham

    I have the following objects:

    public class Parent
    {
    	public BaseChild Child {get;set;}
    }
    
    public class BaseChild
    {
    }
    
    public class ChildOne : BaseChild
    {
    	public string Member {get;set;}
    }
    

    "Parent" is mapped to a "Parent2" type from a different module (which has the same member BaseChild).

    Mapper.CreateMap(typeof(Parent), typeof(Module2::Parent2));
    Mapper.CreateMap(typeof(BaseChild), typeof(Module2::BaseChild));
    Mapper.CreateMap(typeof(ChildOne ), typeof(Module2::ChildOne ));
    

    I'm creating a Parent object:

    Parent parent = new Parent
    {
    	Child = new ChildOne { Member = "Test" }
    }
    

    And try to convert:

    object parent2 = Mapper.Map(parent, parent.GetType(), typeof(Module2::Parent2));
    

    I get the following exception from auto mapper: ---------- {AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping. Mapping types: ChildOne -> BaseChild Test.ChildOne -> Test.BaseChild ---------- I need this mapping to work in order to be able to convert objects from a new "Parent2" type (in the 2nd module) to an old one. How do I make it support inherited types of members in a converted class?

    C# question workspace

  • DataContractSerializer objects conversion performace improvement
    I impeham

    Thanks - i'll look into it

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    Unfortunately, i cannot add the XmlInclude attribute to my types, so using XmlSerializer won't work.

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    That will take a lot of work for implementation & maintenance afterwards which i am trying to avoid. I will have to think about this more. Thanks.

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    After checking AutoMapper i realized that i need to specifically map all internal types of the objects from source to target. this requires as my objects can contain many types and it will require a LOT of work (not to mention maintenance as they change) before it can be used and i need something to do the conversions automatically with minimal work => leads me to my first posted code. So i return to the original question - is it possible to skip the MemoryStream read/write?

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    i will look into it - thanks a lot :)

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    Object converting - right. The problem is that i want to convert objects without knowing its members - it should be done using their names (one property data in object one is copied to object two's property which has the same name). using serialization i can serialize one object from one module to an object of another module easily. I was looking for a way to serialize from one object to another without using a memory stream in the middle - that will solve my problem.

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    Sorry - didn't mean to insult in no way - However, measuring is not the issue here - i am quite sure with the results since the times of the operations are long (~10 seconds) because the objects contains a lot of data - it is not milliseconds of difference.

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    I know how to measure time - thanks - this is not the issue here. I'm looking for someone with DataContractSerializer and serialization experience. Thanks.

    C# performance question code-review

  • DataContractSerializer objects conversion performace improvement
    I impeham

    I am using the following code to convert from one type of object to another. It works fine, but I am looking for a way to improve performance:

        public static object ConvertObject(object source, Type targetType)
        {
            object result;
            Type sourceType = source.GetType();
    
            DataContractSerializer sourceSerializer = new DataContractSerializer(sourceType);
    
            using (MemoryStream ms = new MemoryStream())
            {
                DateTime start = DateTime.Now;
                sourceSerializer.WriteObject(ms, source);
                TimeSpan writeObjectTime = DateTime.Now - start;
    
                ms.Seek(0, SeekOrigin.Begin);
    
                DataContractSerializer targetSerializer = new DataContractSerializer(targetType);
                XmlReader r = XmlReader.Create(ms);
    
                DynamicObjectSerializer.MyReader myreader = new DynamicObjectSerializer.MyReader(r);
    
                start = DateTime.Now;
                result = targetSerializer.ReadObject(myreader);
                TimeSpan readObjectTime = DateTime.Now - start;
    
                LoggerHolder.LogDebug("\\"{0}\\" Write Time = {1}, Read Time = {2}", source.GetType().Name, writeObjectTime, readObjectTime);
            }
            return result;
        }
    

    Using the MemoryStream actually slows the process down since the object is first being written to it and then read from it. If it was possible to serialize the source object to the target one directly it would have been taken half the time. Any idea how this can be done? Thanks.

    C# performance question code-review

  • "An assembly with the same simple name has already been imported" error message
    I impeham

    Signing the assemblies would probably be the best solution - i agree. At the moment it is not feasible since there are clients with this module in the field already that cannot be upgraded with new signed assemblies. I am using a workaround for this in the meantime - I am changing the assembly name from the project properties (changing the version and the title in assembly information did not work). I still have a few tests to do before I'll know it is working for sure (without the need to upgrade any client modules).

    C# help question announcement

  • "An assembly with the same simple name has already been imported" error message
    I impeham

    i already found this before, but it does not offer a working solution: i cannot change the assembly info since it is a compiled module and as i said - the assemblies are not signed, but they have a different version. Any other way to make it work?

    C# help question announcement

  • "An assembly with the same simple name has already been imported" error message
    I impeham

    It won't solve it since i need to load both assemblies in the same domain.

    C# help question announcement

  • "An assembly with the same simple name has already been imported" error message
    I impeham

    I am trying to reference 2 identical assemblies with only their filename and version to be different. I need this in order to support several versions for backward compatibility. I've created an alias name for one of them and the other stayed "global". Also added the "extern alias" declaration at the start of the source code. I'm getting compiler error (my real module name was switched with [module name] here): "An assembly with the same simple name '[module name], Version=1.0.0.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side." One of these two assemblies does have a version 1.0.0.0, but the other has 1.5.0.0 and I can see that when I highlight them in the solution explorer in the properties window. The assemblies are not signed, and I do not currently wish to make them as such. Why is this error? The versions are clearly different… is there a way to solve this? i'm using VS2012.

    C# help question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups