When deployed to IIS, DropDownBase OnParametersSet throws System.IO.FileNotFoundException for Microsoft.CSharp Version=7.0.0.0

I deployed a new Blazor Server app to IIS and at first everything seemed to work fine. However, overnight it seems to have developed an issue that seems to be related to Radzen.DropDownBase.OnParametersSet() - at least, in the logs, that's always where it fails. It seems to be when I navigate to a page that contains the RadzenListBox component.

The application always works fine in development through Visual Studio (v17.5.2) and if I publish the files to the server (as a self-contained app), it seems to work fine initially, but then something happens overnight (it seems) and the app breaks.

Example warning & error messages from the logs below.

Anyone any ideas what's causing this?

Thanks

(EDIT: I was using v4.7.8 of the component library. I've just updated to v4.7.13 to see if that helps.)

2023-03-21 14:10:59.392 +00:00 [WRN] Unhandled exception rendering component: Could not load file or assembly 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Radzen.DropDownBase`1.OnParametersSet()
   at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters)
   at Radzen.DataBoundFormComponent`1.SetParametersAsync(ParameterView parameters)
   at Radzen.DropDownBase`1.SetParametersAsync(ParameterView parameters)
   at Radzen.Blazor.RadzenListBox`1.SetParametersAsync(ParameterView parameters)
2023-03-21 14:10:59.438 +00:00 [ERR] Unhandled exception in circuit 'ErRBsRyoQAHJI0XPOiuPuXJOjD_KPF4bPgdEtAaqcwc'.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Radzen.DropDownBase`1.OnParametersSet()
   at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters)
   at Radzen.DataBoundFormComponent`1.SetParametersAsync(ParameterView parameters)
   at Radzen.DropDownBase`1.SetParametersAsync(ParameterView parameters)
   at Radzen.Blazor.RadzenListBox`1.SetParametersAsync(ParameterView parameters)

You might need to check what's the version of .NET Windows Hosting Bundle installed:

Hm,
i have the 100% exact same problem.

@techsc Check my previous reply:

I'll keep you informed.

Since days now I'm looking after this. I looks like that the site is working as long it is hosted from visual studio. After publishing too iis it mostly works in the first place. Then - after an unpredictable time - the problem comes up as described. It is strange, that the error doesn't trigger at a reproducable point.

However, I'm still investigating the effect of modifying the installed hosting bundles.

I have deployed several complex projects, not developed with radzen components. But my current project produces as the only one on the same server these issue:

"Category: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost
EventId: 111
SpanId: cb28b0ab56415cbf
TraceId: 3fd7c29dcb32107f4ea310ecf1a485d3
ParentId: 0000000000000000
RequestId: 4000000d-0000-fc00-b63f-84710c7967bb
RequestPath: /_blazor
TransportConnectionId: 00q1YcpV2qTW6PZ2j7CQPQ

Unhandled exception in circuit 'EYRp1Md5M8Q4Au3Eb7J8PD_SGhP5MaqjDhDyXcJ8ITw'.

Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Radzen.DropDownBase1.OnParametersSet() at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters) at Radzen.DataBoundFormComponent1.SetParametersAsync(ParameterView parameters)
at Radzen.DropDownBase1.SetParametersAsync(ParameterView parameters) at Radzen.Blazor.RadzenDropDown1.SetParametersAsync(ParameterView parameters)"

Hey @techsc,

Will you post more info related to my previous question?

Ah, sure:
Hosting Bundle 7.0.4 is installed.

I have tried as well the scenario with both 7.0.4 and 7.0.0. And tried combinations with installed a number of runtime versions. No help.

I'm wondering why the error targets that exact Version of Csharp 7.0.0.

Thank You,
Chris

The problem is confirmed from my side on different systems. 1) Windows 11 Pro 2)windows server

Other blazor sites are working and the error comes up with a clean and freshly generated project from blazor studio.

There is no such version of Microsoft.CSharp. The latest version is 4.7.0. Can you verify the application pool you are deploying to is not using .NET (4.x)? Here is some relevant explanation: How do I get .NET 6 into the Application Pool on Windows Server 2019? - Microsoft Q&A

In short it should look like this:

and not like this:

Hi there, I can confirm the correct setting: No managed code.

Do you have the .NET 7 SDK installed as well? If not does installing it help?

I tried it with net sdk but no help. What íˋd like to add: In the past, the code seemed to work with occasional errors. I assume it may have as well to do with the published package.

Hi @techsc,

We found and fixed something that might be related and I'll publish update of Radzen.Blazor (4.8.0) as we speak.

1 Like

Interesting! Latest at afternoon I will be able to re-deploy and report.

Chris

A quick first feedback: Just replaced the radzen dll directly in the published iis site and at looks good. However, my experience says i have test now over time and i will keep you informed!

Thank you so much!

chris

1 Like

Hi all. Thanks for carrying on with this in my absence. My issue was exactly as Chris described. I also have the latest versions of .NET installed. Interestingly, the app has been working without errors for the last two days. However, I need to be sure it's stable before allowing other users to have access.

I'll update to 4.8.0 so hopefully that will resolve the issue for good. :slight_smile:

Thanks,
Gareth

Update: I have now tested the new framework more deeply.

In short: It is unpredictable - the error comes up again.

Try to clear your entire deployed app and redeploy - might have some leftovers.

Sorry. The result is the same:

Category: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost
EventId: 111
SpanId: 6a39e7fc141e4cc2
TraceId: 716b2e0f3bdfd158d4caf16ab2e6ee3f
ParentId: 0000000000000000
RequestId: 4000005c-0001-fe00-b63f-84710c7967bb
RequestPath: /_blazor
TransportConnectionId: zT8xgj2JRZlm1aibf0wCnA

Unhandled exception in circuit 'QZfjABTQ1r5A-cN1IGHrsuOPFhYIVaI4GiM3ds0OmZA'.

Exception:
System.ObjectDisposedException: Cannot access a disposed object.
at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.GrowBuffer(Int32 desiredCapacity) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange1 oldTree, ArrayRange`1 newTree)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Category: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer
EventId: 100
SpanId: 6a39e7fc141e4cc2
TraceId: 716b2e0f3bdfd158d4caf16ab2e6ee3f
ParentId: 0000000000000000
RequestId: 4000005c-0001-fe00-b63f-84710c7967bb
RequestPath: /_blazor
TransportConnectionId: zT8xgj2JRZlm1aibf0wCnA

Unhandled exception rendering component: Cannot access a disposed object.

Exception:
System.ObjectDisposedException: Cannot access a disposed object.
at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder1.GrowBuffer(Int32 desiredCapacity) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange1 oldTree, ArrayRange`1 newTree)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Category: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost
EventId: 111
SpanId: 6a39e7fc141e4cc2
TraceId: 716b2e0f3bdfd158d4caf16ab2e6ee3f
ParentId: 0000000000000000
RequestId: 4000005c-0001-fe00-b63f-84710c7967bb
RequestPath: /_blazor
TransportConnectionId: zT8xgj2JRZlm1aibf0wCnA

Unhandled exception in circuit 'QZfjABTQ1r5A-cN1IGHrsuOPFhYIVaI4GiM3ds0OmZA'.

Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Radzen.DropDownBase1.OnParametersSet() at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters) at Radzen.DataBoundFormComponent1.SetParametersAsync(ParameterView parameters)
at Radzen.DropDownBase1.SetParametersAsync(ParameterView parameters) at Radzen.Blazor.RadzenDropDown1.SetParametersAsync(ParameterView parameters)

Category: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer
EventId: 100
SpanId: 6a39e7fc141e4cc2
TraceId: 716b2e0f3bdfd158d4caf16ab2e6ee3f
ParentId: 0000000000000000
RequestId: 4000005c-0001-fe00-b63f-84710c7967bb
RequestPath: /_blazor
TransportConnectionId: zT8xgj2JRZlm1aibf0wCnA

Unhandled exception rendering component: Could not load file or assembly 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.CSharp, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Radzen.DropDownBase1.OnParametersSet() at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters) at Radzen.DataBoundFormComponent1.SetParametersAsync(ParameterView parameters)
at Radzen.DropDownBase1.SetParametersAsync(ParameterView parameters) at Radzen.Blazor.RadzenDropDown1.SetParametersAsync(ParameterView parameters)

Category: Microsoft.EntityFrameworkCore.Query
EventId: 10102
SpanId: 6a39e7fc141e4cc2
TraceId: 716b2e0f3bdfd158d4caf16ab2e6ee3f
ParentId: 0000000000000000
RequestId: 4000005c-0001-fe00-b63f-84710c7967bb
RequestPath: /_blazor
TransportConnectionId: zT8xgj2JRZlm1aibf0wCnA

The query uses a row limiting operator ('Skip'/'Take') without an 'OrderBy' operator. This may lead to unpredictable results. If the 'Distinct' operator is used after 'OrderBy', then make sure to use the 'OrderBy' operator after 'Distinct' as the ordering would otherwise get erased.

Category: Microsoft.EntityFrameworkCore.Query
EventId: 10102
SpanId: 6a39e7fc141e4cc2
TraceId: 716b2e0f3bdfd158d4caf16ab2e6ee3f
ParentId: 0000000000000000
RequestId: 4000005c-0001-fe00-b63f-84710c7967bb
RequestPath: /_blazor
TransportConnectionId: zT8xgj2JRZlm1aibf0wCnA

The query uses a row limiting operator ('Skip'/'Take') without an 'OrderBy' operator. This may lead to unpredictable results. If the 'Distinct' operator is used after 'OrderBy', then make sure to use the 'OrderBy' operator after 'Distinct' as the ordering would otherwise get erased.