473,385 Members | 1,531 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,385 software developers and data experts.

PreserveSig in VS 2005

I have been trying to migrate a VS 2003 project (dll) to VS 2005. I currently
use PreserveSig attribute on all COM visible properties and functions. When
compiling against the 1.1 framework all is well, but against the 2.0
framework I get “fatal error C1093: API call 'DefineCustomAttribute' failed
'0x801311c0' “. I discovered that by removing the PreserveSig attribute on
property definitions, the project compiles, but now my properties are
converted and exposed to COM in the HRESULT format (not desired). Any ideas?

Thanks,
Chris

Mar 1 '07 #1
5 2288
Hi Chris,

I will perform some research on this issue and get back to you ASAP. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 2 '07 #2
Hi Chris,

Sorry for letting you wait.

Can you tell me why don't want the return type to be HRESULT in the IDL?
What exactly do these definitions look like in C# managed code? Do you
return something other than int/uint?

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 5 '07 #3
Hi Jeffrey,
Can you tell me why don't want the return type to be HRESULT in the IDL?
We currently have umanaged clients that are using our library with preserved
signatures.
What exactly do these definitions look like in C# managed code? Do you
return something other than int/uint?
I am not sure what your question is here. I am writing in managed C++ with
an interface definition that looks something like:

[Guid("someGUIDhere")]
public __gc __interface IMyList :
public IList,
public ICollection
{
public:
[PreserveSig] __property int get_Count();
[PreserveSig] __property bool get_IsFixedSize();
[PreserveSig] __property bool get_IsReadOnly();

[PreserveSig] __property Object * get_Item (int index);
[PreserveSig] __property void set_Item (int index, Object *);

[PreserveSig] int Add(Object * value);
[PreserveSig] void Clear();
[PreserveSig] bool Contains(Object * value);
[PreserveSig] int IndexOf(Object * value);
[PreserveSig] void Insert (int index, Object *value);
[PreserveSig] void Remove(Object * value);
[PreserveSig] void RemoveAt (int index);
};

So I am passing ints, bools and pointers. The PreserveSig works as expected
in VS 2003, C# clients see the properties as C# properties, etc.

Thanks,
Chris
""Jeffrey Tan[MSFT]"" wrote:
Hi Chris,

Sorry for letting you wait.

Can you tell me why don't want the return type to be HRESULT in the IDL?
What exactly do these definitions look like in C# managed code? Do you
return something other than int/uint?

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 6 '07 #4
Hi Chris,

Thanks for your feedback!

It seems that you are using some old style CLR syntax in the new VC++2005.
This may be a side area.

Is it possible for you to send a little sample project to help me reproduce
this problem locally? Then I may perform some deep troubleshooting over it.
You may send the reproduce project to: je***@online.microsoft.com(remove
"online.")

Thanks very much!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 6 '07 #5
Hi Chris,

Additionally, it seems that your old-syntax CLR marks PreserveSig on
properties.

I have also discussed this issue with one COM interop expert internally.
Based on the MSDN document below, PreserveSigAttribute is valid on methods
only(AttributeTargets.Method):
"PreserveSigAttribute Class"
http://msdn2.microsoft.com/en-us/lib...pservices.pres
ervesigattribute.aspx

So it is not supported for properties. In C# if you try and apply it to a
property declaration you will get a compiler error that is worded much
better(in both VS.net2003 and VS2005):
"Attribute 'PreserveSig' is not valid on this declaration type. It is valid
on 'method' declarations only."

Since the PreserveSigAttribute is not supported for properties, we are not
sure why the VC compiler allowed yoru code to compile in VS.NET 2003.

I would recommend you to provide a little sample project to give us a local
reproduce, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 7 '07 #6

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

Similar topics

1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.