1

I was making a program suite to connect to a remote server and send some information via WSDL, this was sucessful and working correctly, but i was ordered to port all my programs into DLL's, i had to enable COM interop and make some returns, most of my programs went fine, until i found this error in one of my programs who use two proxy classes made from a WSDL, i have spend a whole week reading on the web details, but i can't understand how to fix it, this is the error

Warning 1   Type library exporter warning processing 'Tarea.CrSeedService.CrSeedClient, Tarea'. Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute. Tarea    

This is one of the proxy classes who gets the error

http://pastebin.com/y1zFfzER and this is the reference.cs file of the Service Reference

http://pastebin.com/vJuFZqsd

inb4 some people report this question as duplicated I have readed Is it possible to implement a COM interface with a .NET generics class? but still didn't get it

if you see the pastebin i added already in all the classes definitions on the proxy cs file the following

[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(Procesos.Iclass1))]    

where

  [ComVisible(true)]
    public interface  Iclass1
    {
    string Ejecucion(string cn, string speed);
    }

where assemblyinfo.cs

[assembly: ComVisible(true)]

What should i do? What am i doing wrong?

I would appreciate some guidance, VS2013 can't guide me exactly on where is the error although it manually says its "CrSeedService.CrSeedClient" i have added the definitions and still outputs the mistake.

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(Procesos.Iclass1))]
public partial class CrSeedClient :        System.ServiceModel.ClientBase<Tarea.CrSeedService.CrSeed>,   Tarea.CrSeedService.CrSeed
{
blah
}

Regards

Community
  • 1
  • 1
Glas
  • 169
  • 1
  • 3
  • 12
  • I don't see the problem. Editing auto-generated code is of course hazardous, you'll lose all your changes when it gets re-generated. Maybe that's what happened. You also ought to be concerned that you expose *nothing*, the class implementation is hidden but you don't expose an interface either. Client code will have to use late-binding to use this class. – Hans Passant Feb 19 '15 at 18:22
  • it's hard to me to explain, as im a newbie coder, but the main program, calls a method inside another file, which calls to another method in another file, maybe isn't why is exposed in the files i've uploaded, either way, I can't find the file reference.cs in my Solution Explorer, yet i can get into it via Search function. I've added the missing lines and now it's working properly, my apologies – Glas Feb 19 '15 at 19:34

1 Answers1

1

I can't find the file reference.cs in my Solution Explorer, yet i can get into it via Search function (searching "class CrSeedClient")

http://puu.sh/g3Yv8/3e8f11c975.png

So I've added the missing lines and now it's working properly.

[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(Procesos.Iclass1))]
public partial class CrSeedClient

Alternatively you can edit the reference file finding the file manually

http://puu.sh/g3YzU/8523948580.png

maybe it's my fault, call it a rookie mistake, im not sure

Carsten
  • 11,287
  • 7
  • 39
  • 62
Glas
  • 169
  • 1
  • 3
  • 12