This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +0
-50
lines changed
tests/ServiceStack.Text.Tests Expand file tree Collapse file tree 3 files changed +0
-50
lines changed Original file line number Diff line number Diff line change @@ -161,16 +161,6 @@ public static void AssertAllowedRuntimeType(Type type)
161
161
if ( JsConfig . AllowRuntimeType ? . Invoke ( type ) == true )
162
162
return ;
163
163
164
- var denyTypesInNamespaces = JsConfig . DenyRuntimeTypeInNamespaces ;
165
- if ( denyTypesInNamespaces ? . Count > 0 )
166
- {
167
- foreach ( var ns in denyTypesInNamespaces )
168
- {
169
- if ( type . Namespace == ns )
170
- throw new NotSupportedException ( $ "{ type . Name } is not an allowed Runtime Type. Denied in JsConfig.DenyRuntimeTypeInNamespaces") ;
171
- }
172
- }
173
-
174
164
var allowAttributesNamed = JsConfig . AllowRuntimeTypeWithAttributesNamed ;
175
165
if ( allowAttributesNamed ? . Count > 0 )
176
166
{
Original file line number Diff line number Diff line change @@ -921,8 +921,6 @@ public static string[] IgnoreAttributesNamed
921
921
922
922
public static HashSet < string > AllowRuntimeTypeWithInterfacesNamed { get ; set ; }
923
923
924
- public static HashSet < string > DenyRuntimeTypeInNamespaces { get ; set ; }
925
-
926
924
public static HashSet < string > AllowRuntimeTypeInTypesWithNamespaces { get ; set ; }
927
925
928
926
public static Func < Type , bool > AllowRuntimeType { get ; set ; }
@@ -986,7 +984,6 @@ public static void Reset()
986
984
{
987
985
nameof ( DataContractAttribute ) ,
988
986
nameof ( RuntimeSerializableAttribute ) ,
989
- "SerializableAttribute" ,
990
987
} ;
991
988
AllowRuntimeTypeWithInterfacesNamed = new HashSet < string >
992
989
{
@@ -1001,10 +998,6 @@ public static void Reset()
1001
998
{
1002
999
"ServiceStack.Messaging" ,
1003
1000
} ;
1004
- DenyRuntimeTypeInNamespaces = new HashSet < string >
1005
- {
1006
- "System.CodeDom.Compiler" ,
1007
- } ;
1008
1001
PlatformExtensions . ClearRuntimeAttributes ( ) ;
1009
1002
ReflectionExtensions . Reset ( ) ;
1010
1003
JsState . Reset ( ) ;
Original file line number Diff line number Diff line change @@ -108,9 +108,6 @@ public void Does_Serialize_Allowed_Types()
108
108
typeof ( UserAuth ) ,
109
109
typeof ( UserAuthDetails ) ,
110
110
typeof ( Message ) ,
111
- #if NET45
112
- typeof ( SerialiazableType ) ,
113
- #endif
114
111
} ;
115
112
116
113
foreach ( var allowType in allowTypes )
@@ -176,9 +173,6 @@ public void Does_Serialize_Allowed_Types_in_Objects_Array()
176
173
typeof ( UserAuth ) ,
177
174
typeof ( UserAuthDetails ) ,
178
175
typeof ( Message ) ,
179
- #if NET45
180
- typeof ( SerialiazableType ) ,
181
- #endif
182
176
} ;
183
177
184
178
foreach ( var allowType in allowTypes )
@@ -205,32 +199,5 @@ public void Does_allow_Unknown_Type_in_MQ_Messages()
205
199
var fromJson = json . FromJson < Message > ( ) ;
206
200
Assert . That ( fromJson . Body . GetType ( ) , Is . EqualTo ( typeof ( AType ) ) ) ;
207
201
}
208
-
209
- [ Test ]
210
- public void Does_not_allow_Types_in_DenyRuntimeTypeInTypesWithNamespaces ( )
211
- {
212
- //Uses JsConfig.DenyRuntimeTypeInNamespaces
213
-
214
- var types = new Type [ ]
215
- {
216
- #if NET45
217
- typeof ( System . CodeDom . Compiler . TempFileCollection )
218
- #endif
219
- } ;
220
-
221
- foreach ( var type in types )
222
- {
223
- var json = CreateJson ( type ) ;
224
- try
225
- {
226
- var instance = json . FromJson < RuntimeObject > ( ) ;
227
- Assert . Fail ( "Should throw " + type . Name ) ;
228
- }
229
- catch ( NotSupportedException ex )
230
- {
231
- ex . Message . Print ( ) ;
232
- }
233
- }
234
- }
235
202
}
236
203
}
You can’t perform that action at this time.
0 commit comments