Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
0.14.0, 0.15.0, 0.14.1
-
None
Description
Creating the following 2 thrift files:
Enums.thrift
namespace * enums
enum FoobarEnum {
Val_1 = 0,
Val_2 = 1
}
Service.thrift
namespace * service include "Enums.thrift" struct RequestModel { // Breaks 1: optional set<Thriftxxxx.objs.FoobarEnum> data_1 = [ FoobarEnum.Val_1, FoobarEnum.Val_2 ], // Breaks 2: optional list<Thriftxxxx.objs.FoobarEnum> data_2 = [ FoobarEnum.Val_1, FoobarEnum.Val_2 ], // Works 3: optional Thriftxxxx.objs.FoobarEnum data_3 = FoobarEnum.Val_1 } service Test { void CallMe( 1 : RequestModel foo, ) }
Will generate a cs file that when compiled throws the following error for 2 items in the set and 2 items in the list:
RequestModel.cs(96,24): error CS0103: The name 'FoobarEnum' does not exist in the current context
Generated code from the RequestModel looks like this
public RequestModel() { this._data_1 = new THashSet<global::Thriftxxxx.objs.FoobarEnum>(); this._data_1.Add(FoobarEnum.Val_1); this._data_1.Add(FoobarEnum.Val_2); this.__isset.data_1 = true; this._data_2 = new List<global::Thriftxxxx.objs.FoobarEnum>(); this._data_2.Add(FoobarEnum.Val_1); this._data_2.Add(FoobarEnum.Val_2); this.__isset.data_2 = true; this._data_3 = global::Thriftxxxx.objs.FoobarEnum.Val_1; this.__isset.data_3 = true; }
The code in the FoobarEnum elements in the Add() methods are missing the namespace.
Attachments
Issue Links
- links to