Archived
This forum has been archived. Please start a new discussion on GitHub.
slice2cs bugs
Hi ZeroC team!
Recently I encountered two bugs in slice2cs compiler. Both of them lead to the compilation errors.
1) If I extend interface which has method with optional return value then generated code for child interface's Disp_ class has wrong signature: it returns just T instead of Ice.Optional<T>. Though other generated C# interfaces have correct signature.
For example:
2) If I use clr:serializable attribute to be able to use native C# struct then it works well unless I'm trying to use this struct as a return value. In the latter case slice2cs generates incorrect implementation of DelD_ class: in the beginning of the method it tries to assign null to the variable of the struct type. I was digging in generated code for a while and didn't see any specific reason to use null instead of default(T) here.
For example:
I hope that I provided clear explanations but if you need any additional assistance then don't hesitate to ask.
Thank you.
Recently I encountered two bugs in slice2cs compiler. Both of them lead to the compilation errors.
1) If I extend interface which has method with optional return value then generated code for child interface's Disp_ class has wrong signature: it returns just T instead of Ice.Optional<T>. Though other generated C# interfaces have correct signature.
For example:
interface Printer {
void printString(string s);
optional (1) string getName();
};
interface Xerox extends Printer {
};
generates that:
public abstract class XeroxDisp_ : Ice.ObjectImpl, Xerox
{
#region Inherited Slice operations
public string getName()
{
return getName(Ice.ObjectImpl.defaultCurrent);
}
public abstract string getName(Ice.Current current__);
2) If I use clr:serializable attribute to be able to use native C# struct then it works well unless I'm trying to use this struct as a return value. In the latter case slice2cs generates incorrect implementation of DelD_ class: in the beginning of the method it tries to assign null to the variable of the struct type. I was digging in generated code for a while and didn't see any specific reason to use null instead of default(T) here.
For example:
["clr:serializable:System.DateTime"]
sequence<byte> DateTime;
interface Printer {
DateTime getDateTime();
};
generates that:
public sealed class PrinterDelD_ : Ice.ObjectDelD_, PrinterDel_
{
[_System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031")]
public global::System.DateTime getDateTime(_System.Collections.Generic.Dictionary<string, string> context__, Ice.Instrumentation.InvocationObserver observer__)
{
Ice.Current current__ = new Ice.Current();
initCurrent__(ref current__, "getDateTime", Ice.OperationMode.Normal, context__);
global::System.DateTime result__ = null;
I hope that I provided clear explanations but if you need any additional assistance then don't hesitate to ask.
Thank you.
0
Comments
-
Thanks for the report. We will look into fixing these issues in our next release.0
-
Thanks dwayne. Is there any estimated release date for the next version?0