System.Net.WebRequest.Create Failed at Unity 2021 LTS

at System.Net.WebRequestPrefixElement…ctor (System.String P, System.Type creatorType) [0x00018] in <5017e4c186df4a78b7441939f7934083>:0 06-02 15:44:52.311 27304 27358 I Unity : at System.Net.WebRequest.PopulatePrefixList () [0x00040] in <5017e4c186df4a78b7441939f7934083>:0 06-02 15:44:52.311 27304 27358 I Unity : at System.Net.WebRequest.get_PrefixList () [0x00022] in <5017e4c186df4a78b7441939f7934083>:0 06-02 15:44:52.311 27304 27358 I Unity : at System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase)

This is the error stack。。

It work well at 2019LTS。

Edit:This error happens on mono, and il2cpp works.

2 Likes

I had the same issue while building for Android (Oculus). Changing to IL2CPP fixed for me too

We have a bug report for this issue: Unity Issue Tracker - [Android] &quot;WebRequest.Create&quot; cause an exception when Mono is used

The bug report is currently being investigated.

Hello @JoshPeterson , I see that the issue is resolved. Could you please explain what was the fix. I need it for my project where wwe see same error in mono but for linux.

I don’t think you can fix it from your side, unfortunately. The problem had to do with how the machine.config file from Mono was used in the Unity build process internally.

So it might be the case that this still happens on Linux, even though we corrected it for Android. Can you submit a new bug report?

https://unity.com/releases/editor/qa/bug-reporting

1 Like