473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Com Interop generating wrong cases for interfaces

Folks,

We have a C# method which we register as part of a class for COM Interop:

public void send(string contents, string filepath ,string filename)

{

}

The type library produced for the assembly contains the following method
information:

void send(

[in] BSTR contents,

[in] BSTR FilePath,

[in] BSTR FileName);

Notice how the original parameters filename and filepath have been changed
to FileName and FilePath.

This is breaking all of our COM bindings in a significant amount of XLANG
schedules as the parameter messages need re-created. We cannot afford to do
this.

Also notice how the parameter signiature has not been changed.

Builds over 2 weeks have been fine through VS.NET, because older DLLS from
our SourceSafe database actually compile for InterOp correctly using
TBLEXP.exe - i.e. the com interfaces get generated with lowercase letters.

Very confused! Can anyone suggest a solution for this, as we now cannot
deploy new codebases to production.

Thanks in advance,

Conor
Nov 22 '05 #1
7 2032
>Notice how the original parameters filename and filepath have been changed
to FileName and FilePath.


This is most likely due to a "feature" in the oleaut typelib
generation code. See

BUG: MIDL Changes the Case of Identifier in Generated Type Library
http://support.microsoft.com/?kbid=220137

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 22 '05 #2
Hi Conor,

Maybe I have missing something, but based on my test, I can not reproduce
the problem.

I have a class as below.
using System;
using System.Runtime.InteropServices;
namespace TestCapicalizeParameter
{
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Class1
{
public Class1()
{
}
public void send(string contents, string filepath ,string filename)
{
}
}
}

After I check the Register for COM Interop in the project setting, I will
get the typelib as below.

[id(0x60020004)]
void send(
[in] BSTR contents,
[in] BSTR filepath,
[in] BSTR filename);
NOTE: the filepath and filename are not capitalized.

I tested on VS.NET 2003(.NET framework 1.1).

If I have any misunderstanding, please feel free to post here.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 22 '05 #3
Thanks Mattias,

I'll hunt through the project classes to see where there may be another
signature similiar causing the problem.

regs,
Conor

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:e%***************@tk2msftngp13.phx.gbl...
Notice how the original parameters filename and filepath have been
changed
to FileName and FilePath.


This is most likely due to a "feature" in the oleaut typelib
generation code. See

BUG: MIDL Changes the Case of Identifier in Generated Type Library
http://support.microsoft.com/?kbid=220137

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 22 '05 #4
Thanks Peter.

I think, referring to Mattias's email alongside yours, we may have another
signature in there that has for some reason caused the compiler to reach it
first (I think we re-strucutured some classes), even though it will not be
marked as requiring a class interface for COM as it is dotnet only. Then
perhaps it is compiling our method that is marked for COM interface
generation, incorrectly.

If this is the case, interop is a bit of a minefield. Surely if my method
is dotnet only, the compiler should just ignore it completely.

I will report back my findings at some stage today.

Thanks,
Conor

""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:BS**************@TK2MSFTNGXA03.phx.gbl...
Hi Conor,

Maybe I have missing something, but based on my test, I can not reproduce
the problem.

I have a class as below.
using System;
using System.Runtime.InteropServices;
namespace TestCapicalizeParameter
{
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Class1
{
public Class1()
{
}
public void send(string contents, string filepath ,string filename)
{
}
}
}

After I check the Register for COM Interop in the project setting, I will
get the typelib as below.

[id(0x60020004)]
void send(
[in] BSTR contents,
[in] BSTR filepath,
[in] BSTR filename);
NOTE: the filepath and filename are not capitalized.

I tested on VS.NET 2003(.NET framework 1.1).

If I have any misunderstanding, please feel free to post here.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 22 '05 #5
Mattias,

That was the problem - thanks a lot - saved us a load of days there.

We had added a new COM method in a class that was higher up alphabetically
in the project. Although this had a different signature, it did have
parameter names that were Pascal cased. This meant that the compiler
changed every other occurrance of these parameter names in each of the other
COM methods.

This breaks the COM bindings in our existing methods calls in the
case-sensitive message naming world of XLANG.

Thanks again for all your help.

regs,
Conor

"Conor Maguire" <Th****@newsgroup.nospam> wrote in message
news:O4**************@tk2msftngp13.phx.gbl...
Thanks Mattias,

I'll hunt through the project classes to see where there may be another
signature similiar causing the problem.

regs,
Conor

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:e%***************@tk2msftngp13.phx.gbl...
>Notice how the original parameters filename and filepath have been
>changed
to FileName and FilePath.


This is most likely due to a "feature" in the oleaut typelib
generation code. See

BUG: MIDL Changes the Case of Identifier in Generated Type Library
http://support.microsoft.com/?kbid=220137

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Nov 22 '05 #6
Peter,

See my response to Mattias.

And thanks for your help and your quick response.

regs,
Conor

"Conor Maguire" <Th****@newsgroup.nospam> wrote in message
news:uc*************@TK2MSFTNGP12.phx.gbl...
Thanks Peter.

I think, referring to Mattias's email alongside yours, we may have another
signature in there that has for some reason caused the compiler to reach
it first (I think we re-strucutured some classes), even though it will not
be marked as requiring a class interface for COM as it is dotnet only.
Then perhaps it is compiling our method that is marked for COM interface
generation, incorrectly.

If this is the case, interop is a bit of a minefield. Surely if my method
is dotnet only, the compiler should just ignore it completely.

I will report back my findings at some stage today.

Thanks,
Conor

""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:BS**************@TK2MSFTNGXA03.phx.gbl...
Hi Conor,

Maybe I have missing something, but based on my test, I can not reproduce
the problem.

I have a class as below.
using System;
using System.Runtime.InteropServices;
namespace TestCapicalizeParameter
{
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Class1
{
public Class1()
{
}
public void send(string contents, string filepath ,string filename)
{
}
}
}

After I check the Register for COM Interop in the project setting, I will
get the typelib as below.

[id(0x60020004)]
void send(
[in] BSTR contents,
[in] BSTR filepath,
[in] BSTR filename);
NOTE: the filepath and filename are not capitalized.

I tested on VS.NET 2003(.NET framework 1.1).

If I have any misunderstanding, please feel free to post here.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.


Nov 22 '05 #7
Hi Conor,

Thanks for your feedback and thanks for Mattias's knowledge sharing in the
community.

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Dolheguy | last post by:
I am in desperate need to get help in answering some questions in regards to building a DCOM Server using C#. I need to create a DCOM server using C#.NET, I realise that you first need to create...
7
by: Conor Maguire | last post by:
Folks, We have a C# method which we register as part of a class for COM Interop: public void send(string contents, string filepath ,string filename) {
5
by: Eric St-Onge | last post by:
Hi all, I have a C# DLL containing only interfaces that I want to have a TLB (type library) generated for. For that I use the "Register for COM Interop" compiler option but it gives me the...
20
by: Razzie | last post by:
Hey all, I'm really going through a small hell right now - I've completely lost it :) I made a project, using two interop libraries from exchange (created them as in this msdn article:...
8
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be...
2
by: Steve | last post by:
I'm using Visual Studio .NET (not 2003), and am developing a class that works with Word theough the Office PIAs (Interop). I can open word and do things with it programatically, but I can't close...
1
by: tcarvin | last post by:
If you are not in the mood for a rant, then leave now... I figure most VB.NET programmers have a VB6 background, so I hope you all don't mind the semi-VB.NET related Interop posting. Like most...
1
by: Varun Bansal | last post by:
Hi, I've written a C# dll and I'm trying to return a "List of structures" to my C++ client application. I'm getting this warning while compiling my C# dll. Warning 1 Type library exporter...
1
by: Don.Leri | last post by:
Hi, I have a logger.dll (unmanaged c++ dll compiled in vs2005). I have a C# interop to use that dll in managed code implemented in Interfaces.dll (used by other C# dlls). I also have a...
1
by: Bhrionn | last post by:
Hello World, I am working on implementing a build for my companies application. The scenario implemeted is producing the error: ‘Class does not support automation or does not support expected...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.