Is System.Net.Http blocked?Solved

Is System.Net.Http blocked by umod's compiller? or atleast partly blocked?

When trying to use the HttpClient.PostAsync method the compiller makes the error:

error CS0023: The `.' operator cannot be applied to operand of type `System.Net.Http.HttpClient'

witch doesn't really make sence does it?

Visuel studio is complitly fine with what I'm trying to do and I even tryed it out on a local Console application first

That error looks like a C# compatibility error (trying to use a C# feature above C# 6), not it being blocked. The message you see when something is blocked will clearly be different, but in this case that is most likely blacklisted in Oxide.
Without seeing the actual code of yours, I can't tell exactly what's the point here (error message is really strange in this case), but try to lower target C# version in your csproj (<LangVersion> attribute / or through VS), it will allow static code analyser to match Oxide's ruleset closer. Also I recommend to use some more advanced analysis tools (Like ReSharper or PVS-Studio), they usually see much more potential errors.

UPD. Not sure, if it helps: Link
In response to Wulf ():
That error looks like a C# compatibility error (trying to use a C# feature above C# 6), not it being...
Doesn't Oxide block plugin before compilation actually?
In response to 2CHEVSKII ():
Without seeing the actual code of yours, I can't tell exactly what's the point here (error message i...
void ProcessDiscordComLink()
        {
            
            Puts($"Processing and sending {discordChatMessages.Count} chat messages to discord");
            HttpClient client = new HttpClient();
            foreach (tacti.DiscordChatMessage message in discordChatMessages)
            {
                


                Dictionary<string, string> data = new Dictionary<string, string>()
                {
                    {"username", message.playerName},
                    {"content", message.datetime.ToShortTimeString() + " (UTC): " + message.message }
                };

                
                


                client.PostAsync("Insert discord api link here", new FormUrlEncodedContent(data));
            }
            
            discordChatMessages.Clear();
        }

//Where discordChatMessages is a chat message buffer


Thats the method the error comes in
(I know there're most likely is a plugin already made for this or what ever but I wanted to do it my self)



Merged post

Error while compiling: TactiPLugin.cs(1850,24): error CS0023: The `.' operator cannot be applied to operand of type `System.Net.Http.HttpClient'



Merged post

"[SERVER v1.0.24] Console: TactiPLugin.cs(1834,13): error CS1070: The type `System.Net.Http.HttpClient' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'"

Right... So I guess I've to use a ortherway to make a http post request then`?



Merged post

And using System.Net webRequest makes the exception:

(UnauthorizedAccessException: System access is restricted, you are not allowed to use System.Net.HttpWebRequest)

): So is that umod blocking that or is it something else?



Merged post

https://umod.org/documentation/api/web-requests

Merged post

Alrighty then should have seached on the umod docs first...

So now I need a way to encode a string to be (post friendly) aka WebUtility.UrlEncode does exactly what I want but I'm not allowed to use it ):

"UnauthorizedAccessException: System access is restricted" is from Oxide.

For what you want, System.Uri.EscapeDataString should work fine.
ok thanks
Locked automatically