When I try to view a report in a project in Blazor I get this error in program.cs when it is executed
Code:
// program.cs
using Microsoft.EntityFrameworkCore;
using Mttoplus2.Components;
using Radzen;
using Stimulsoft.Base;
using Stimulsoft.Report;
using Stimulsoft.Report.Blazor;
using Stimulsoft.Report.Web;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Stimulsoft.Report.Mvc;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddHubOptions(options => options.MaximumReceiveMessageSize = 10 * 1024 * 1024);
// Configurar controladores y excluir los de Stimulsoft
builder.Services.AddControllers()
.ConfigureApplicationPartManager(manager =>
{
manager.FeatureProviders.Add(new ExcludeStimulsoftControllersFeatureProvider());
});
builder.Services.AddRadzenComponents();
builder.Services.AddHttpClient();
builder.Services.AddScoped<Mttoplus2.mtto2Service>();
builder.Services.AddScoped<NotificationService>();
builder.Services.AddScoped<TooltipService>();
builder.Services.AddDbContext<Mttoplus2.Data.mtto2Context>(options =>
{
options.UseSqlServer(builder.Configuration.GetConnectionString("mtto2Connection"));
});
builder.Services.AddLocalization();
// Configuración de Stimulsoft
try
{
StiLicense.LoadFromString("una licencia");
// Reemplaza con tu licencia
builder.Services.AddSingleton<StiNetCoreViewerOptions>();
builder.Services.AddScoped<StiNetCoreViewer>();
}
catch (Exception ex)
{
// Log del error de licencia
Console.WriteLine($"Error al cargar la licencia de Stimulsoft: {ex.Message}");
}
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRequestLocalization(options =>
options.AddSupportedCultures("es-AR")
.AddSupportedUICultures("es-AR")
.SetDefaultCulture("es-AR"));
app.UseAntiforgery();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapRazorComponents<App>().AddInteractiveServerRenderMode();
});
app.Run();
//*****
El error que genera es:
System.TypeLoadException: 'Could not load type 'Stimulsoft.System.Web.UI.WebControls.Panel' from assembly 'Stimulsoft.System.Web, Version=2025.1.6.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a'.'
System.TypeLoadException
HResult=0x80131522
Mensaje = Could not load type 'Stimulsoft.System.Web.UI.WebControls.Panel' from assembly 'Stimulsoft.System.Web, Version=2025.1.6.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a'.
Origen = <No se puede evaluar el origen de la excepción>
Seguimiento de la pila:
<No se puede evaluar el seguimiento de la pila de excepciones>
alguna idea de como solucionarlo ??
PackageReference in .csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<NoWarn>CS0168,CS1998,BL9993,CS0649,CS0436,0436</NoWarn>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="Components\Pages\StiReportViewer.blazor" />
<None Remove="Views\Shared\StiReportViewer.blazor" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Radzen.Blazor" Version="6.2.4" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.2" />
<PackageReference Include="Stimulsoft.Reports.Blazor" Version="2025.1.6" />
<PackageReference Include="Stimulsoft.Reports.Engine.Blazor" Version="2025.1.6" />
<PackageReference Include="Stimulsoft.Reports.Engine.NetCore" Version="2025.1.6" />
<PackageReference Include="Stimulsoft.Reports.Web.NetCore" Version="2025.1.6" />
</ItemGroup>
<ItemGroup>
<Folder Include="Views\Shared\" />
</ItemGroup>
</Project>
System.TypeLoadException: 'Could not load type 'Stimulsoft.System.Web.UI.WebControls.Panel'
Re: System.TypeLoadException: 'Could not load type 'Stimulsoft.System.Web.UI.WebControls.Panel'
Fix IT!!
Only
<PackageReference Include="Stimulsoft.Reports.Blazor" Version="2025.1.6" />
Only
<PackageReference Include="Stimulsoft.Reports.Blazor" Version="2025.1.6" />
-
- Posts: 942
- Joined: Tue Sep 07, 2021 10:11 am
Re: System.TypeLoadException: 'Could not load type 'Stimulsoft.System.Web.UI.WebControls.Panel'
Hello,
Ok.
Let us know if you need our help.
Thank you.
Ok.
Let us know if you need our help.
Thank you.