Skip to content

Commit 622ce30

Browse files
committed
Fixes for HttpUtility.UrlEncode for Unity aot and jit profiles
For aot, this commit moves the HttpUtility back to the System.Web dll. We are keeping a small footprint for System.Web, only what is needed for this class.  Also the netstandard facade has been updated to include System.Web. For the Jit profile a change is needed in GetCustomEncoderFromConfig for Android. The jit version of System.Web does not use the MOBILE define as the jit profile is typically used for desktop? This check gives Android a safe fallback. (case 1305211)`
1 parent 438fa25 commit 622ce30

File tree

7 files changed

+33
-4
lines changed

7 files changed

+33
-4
lines changed

mcs/class/Facades/netstandard/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
2323
ifeq ($(PROFILE),xammac_net_4_5)
2424
LIB_REFS += System.Web.Services
2525
else ifeq (2.1, $(FRAMEWORK_VERSION))
26-
ifneq ($(PROFILE),unityaot)
26+
ifeq ($(PROFILE),unityaot)
27+
LIB_REFS += System.Web
28+
else
2729
LIB_REFS += System.Web.Services
2830
endif
2931
else

mcs/class/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ unityaot_dirs := \
363363
System.Runtime.CompilerServices.Unsafe, $(mobile_common_dirs)) \
364364
System.Drawing \
365365
System.Data.DataSetExtensions \
366+
System.Web \
366367
$(pcl_facade_dirs)
367368

368369
xbuild_2_0_dirs := \

mcs/class/System.Web/Assembly/AssemblyInfo.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
using System.Runtime;
3838
using System.Runtime.CompilerServices;
3939
using System.Runtime.InteropServices;
40+
#if !UNITY_AOT
4041
using System.Web.UI;
42+
#endif
4143

4244
// General Information about the System.Web assembly
4345

@@ -56,7 +58,9 @@
5658
[assembly: NeutralResourcesLanguage("en-US")]
5759

5860
[assembly: AllowPartiallyTrustedCallers()]
61+
#if !UNITY_AOT
5962
[assembly: TagPrefix("System.Web.UI.WebControls", "asp")]
63+
#endif
6064
#if !(TARGET_DOTNET)
6165
[assembly: AssemblyDelaySign(true)]
6266

@@ -65,6 +69,7 @@
6569
[assembly: Dependency ("System", LoadHint.Always)]
6670
[assembly: SecurityRules (SecurityRuleSet.Level2, SkipVerificationInFullTrust=true)]
6771

72+
#if !UNITY_AOT
6873
[assembly: TypeForwardedTo (typeof (System.Web.Security.MembershipPasswordException))]
6974
[assembly: TypeForwardedTo (typeof (System.Web.Security.RoleProvider))]
7075
[assembly: TypeForwardedTo (typeof (System.Web.Security.MembershipCreateStatus))]
@@ -76,6 +81,7 @@
7681
[assembly: TypeForwardedTo (typeof (System.Web.Security.MembershipUserCollection))]
7782
[assembly: TypeForwardedTo (typeof (System.Web.Security.MembershipProviderCollection))]
7883
[assembly: TypeForwardedTo (typeof (System.Web.Security.MembershipProvider))]
84+
#endif
7985

8086
[assembly: InternalsVisibleTo ("Microsoft.Web.Infrastructure, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
8187

@@ -87,6 +93,7 @@
8793
[assembly: InternalsVisibleTo ("net_4_x_System.Web_test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
8894
// Resources
8995

96+
#if !UNITY_AOT
9097
[assembly: WebResource ("TreeView_noexpand.gif", "image/gif")]
9198
[assembly: WebResource ("TreeView_dash.gif", "image/gif")]
9299
[assembly: WebResource ("TreeView_dashminus.gif", "image/gif")]
@@ -131,3 +138,4 @@
131138
[assembly: WebResource ("GridView.js", "text/javascript")]
132139
[assembly: WebResource ("webform.js", "text/javascript")]
133140
[assembly: WebResource ("WebUIValidation_2.0.js", "text/javascript")]
141+
#endif

mcs/class/System.Web/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ ifneq (plainweb/,$(intermediate))
255255
LIB_REFS += System.Web.Services plaindesign/System.Design
256256
LIB_MCS_FLAGS += -define:WEBSERVICES_DEP
257257

258+
# The unityaot profile only compile in 3 classes : strip out references and resources that do not need to be there at this time.
259+
ifeq (unityaot, $(PROFILE))
260+
LIB_REFS:=$(filter-out System.EnterpriseServices System.Runtime.Serialization.Formatters.Soap System.Web.ApplicationServices System.Configuration plaindesign/System.Design, $(LIB_REFS))
261+
OTHER_RES:=$(filter-out $(RESOURCE_FILES_1) $(RESOURCE_FILES_2) $(RESOURCE_FILES_4), $(OTHER_RES))
262+
endif
263+
258264
all-local: System.Web/UplevelHelper.cs
259265

260266
endif

mcs/class/System.Web/System.Web.Util/HttpEncoder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ static HttpEncoder GetCustomEncoderFromConfig ()
167167
return defaultEncoder.Value;
168168
#else
169169
var cfg = HttpRuntime.Section;
170+
// The unityjit profile is only built once for desktop and mobile.
171+
// When the jit profile is running on a mobile platform (aka Android) this returns null.
172+
// We will simply return the default encoder.
173+
if(cfg == null)
174+
return Default;
175+
170176
string typeName = cfg.EncoderType;
171177

172178
if (String.Compare (typeName, "System.Web.Util.HttpEncoder", StringComparison.OrdinalIgnoreCase) == 0)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Assembly/AssemblyInfo.cs
2+
../../build/common/Consts.cs
3+
../../build/common/Locale.cs
4+
../../build/common/MonoTODOAttribute.cs
5+
../System/System/MonoToolsLocator.cs
6+
7+
System.Web/HttpUtility.cs
8+
System.Web.Util/Helpers.cs
9+
System.Web.Util/HttpEncoder.cs

mcs/class/System/unityaot_System.dll.sources

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#include mobile_System.dll.sources
2-
../System.Web/System.Web/HttpUtility.cs
3-
../System.Web/System.Web.Util/Helpers.cs
4-
../System.Web/System.Web.Util/HttpEncoder.cs
52
System.CodeDom/CodeCompileUnit.cs
63
System.CodeDom/CodeTypeDeclaration.cs
74

0 commit comments

Comments
 (0)