Uri does not exist
I have a report that grabs images from Azure Blob Storage. It was working just fine until I updated to FastReports.Net 2025.1.6. I just tested with FastReports.Net 2025.2.4 and the same thing is happening.
In my Code page, I have a function:
public string EscapeString(string myString)
{
return Uri.EscapeDataString(myString);
}
Through some research, during Compile, it looks like AddStubClasses in MsAssemblyDescriptor shows that Uri belongs to System.Net instead of System.
Comments
It looks like the update to FastReports.Net changed how assemblies are being referenced during compilation. If
Uri
is now being recognized underSystem.Net
instead ofSystem
, you might try explicitly adding ausing System;
at the top of your code page or fully qualifying the call likeSystem.Uri.EscapeDataString(myString)
. This can sometimes resolve issues where the compiler is picking up the wrong assembly reference.Regardings,
snake game
I have been using the Fast Report .NET Designer to generate the .rpt file. The code page always has default using statements. I had tried a combination of different attempts but still cannot seem to get EscapeDataString to work. I may just end up writing my own function for escaping the strings. Below are my attempts.
-----
using System;
Uri.EscapeDataString(myString);
This previews in the Designer but not from my API using FastReport.Net v 2025.1.16
"Exception occurred: (21,15): Error CS0103: The name 'Uri' does not exist in the current context\r\n"
-----
using System;
System.Uri.EscapeDataString(myString);
This previews in the Designer but not from my API using FastReport.Net v 2025.1.16
"Exception occurred: (21,15): Error CS1069: The type name 'Uri' could not be found in the namespace 'System'. This type has been forwarded to assembly 'System.Private.Uri, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.\r\n"
-----
using System;
using System.Private;
System.Private.Uri.EscapeDataString(myString);
In the Designer,
"Error CS0234: The type or namespace name 'Private' does not exist in the namespace 'System' (are you missing an assembly reference?)"
From the API,
"Exception occurred: (22,15): Error CS0234: The type or namespace name 'Uri' does not exist in the namespace 'System.Private' (are you missing an assembly reference?)\r\n"
-----
using System;
using System.Net;
Uri.EscapeDataString(myString);
This previews in the Designer but not from my API using FastReport.Net v 2025.1.16
"Exception occurred: (22,19): Error CS0117: Please, don't use the method 'EscapeDataString'\r\n"
-----
using System;
using System.Net;
System.Net.Uri.EscapeDataString(myString);
This previews in the Designer but not from my API using FastReport.Net v 2025.1.16
"Exception occurred: (22,19): Error CS0117: Please, don't use the method 'EscapeDataString'\r\n"