We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

New HTMLDocument from text file fails under UWP Release configuration

Create a Visual Basic UWP project in Visual Studio.
In MainPage.xaml:

<Page
    x:Class="HTML解析测试.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:HTML解析测试"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
	<TextBlock x:Name="Value"/>
</Page>

In MainPage.xaml.vb:

' https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x804 上介绍了“空白页”项模板

''' <summary>
''' 可用于自身或导航至 Frame 内部的空白页。
''' </summary>
Public NotInheritable Class MainPage
    Inherits Page

	Private Async Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
		Dim HtmlDocument As New Aspose.Html.HTMLDocument(Await (Await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(New Uri("ms-appx:///HTML文档.html"))).OpenStreamForReadAsync, "http://wj.shtc.cn")
		Value.Text = DirectCast(HtmlDocument.GetElementById("__VIEWSTATE"), Aspose.Html.HTMLInputElement).Value
	End Sub
End Class

This code should find the input element with ID “__VIEWSTATE” from the HTML text file and show its value. However, it run successfully only under Debug configuration. Aspose can’t find the element under Release configuration.
Visual Studio version:
Microsoft Visual Studio Community 2022 (64 位) - Preview
版本 17.3.0 Preview 1.1
Reproduce.zip (30.8 KB)

@Silver_Fang

We are working over your query and will get back to you soon.

@Silver_Fang

We have logged this problem in our issue tracking system as HTMLNET-3866. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@Silver_Fang

Please use synchronous methods to get the desired output as shown below.

Dim HtmlDocument As New Aspose.Html.HTMLDocument((Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(New Uri("ms-appx:///HTML文档.html"))
.GetAwaiter().GetResult()).OpenStreamForReadAsync.GetAwaiter()
.GetResult(), "http://wj.shtc.cn")