Skip to content

Wrong conversion of method returns wchar_t* #241

@Ilyasml

Description

@Ilyasml

Hello

I have an interface which looks like

class IString
{
public:
	virtual const wchar_t* String() = 0;
	virtual HRESULT  SetStringOutProp(const wchar_t* Value) = 0;
};

where method const wchar_t* String() converts to

 /// <summary>
 /// No documentation.
 /// </summary>
 /// <returns>No documentation.</returns>
 /// <unmanaged>const wchar_t* IString::String()</unmanaged>
 /// <unmanaged-short>IString::String</unmanaged-short>
 public unsafe System.String String()
 {
     System.String __result__;
     System.IntPtr __result__native;
     __result__native = TrySharpGenTools.LocalInterop.CalliThisCallSystemIntPtr(this._nativePointer, (*(void ***)this._nativePointer)[0]);
     return __result__;
 }

the code above ( public unsafe System.String String()) gives error of

1>D:\Projects\ForLinuxTranslation\Current\TrySharpGenTools\TrySharpGenTools\obj\Debug\net8.0\SharpGen\Generated\Interfaces.cs(91,20,91,30): error CS0165: Use of unassigned local variable '__result__' 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions