Client Side Blazor - Adding Security Causes Compilation Errors

I've seen this error in my "main project."

Here's a demo to reproduce the issue...

Steps to Reproduce:

  1. Create New Radzen Application Project.
    a. Select Blazor Client Side
    b. Name: RadzenTest
    c. Directory: C:\Users\richa\Documents\Radzen

  2. Click Data | New

  3. Select MS SQL Server
    a. Name: Test
    b. Server: localhost
    c. Database: Test
    d. Authentication: Windows Authentication

  4. Click Create Sample Schema

  5. On this page, select all option boxes

  6. Click Finish.

  7. Go back to the Application's "main" page.

  8. Click Security.

  9. Select Provider Default

  10. Click Autogenerate pages.

  11. Select Data Source Test

  12. Click Enable MultiTenancy

  13. Click Save

  14. Click Run

  15. Note the following error:

radzen: Generating code ...
radzen: Code generation done in 260ms.
dotnet: watch :
dotnet: Started

dotnet: C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationRolesController.cs(31,53): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]

dotnet: C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationRolesController.cs(35,32): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationRolesController.cs(53,40): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationRolesController.cs(56,62): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationRolesController.cs(77,40): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationRolesController.cs(20,42): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationRolesController.cs(24,59): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationUsersController.cs(241,56): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationUsersController.cs(245,33): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationUsersController.cs(268,43): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationUsersController.cs(308,43): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationUsersController.cs(311,78): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationUsersController.cs(341,43): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]
C:\Users\richa\Dev\Radzen\Test\server\Controllers\ApplicationUsersController.cs(344,63): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'Test.Controllers.Test' (are you missing an assembly reference?) [C:\Users\richa\Dev\Radzen\Test\server\Test.Server.csproj]

dotnet:

dotnet: The build failed. Fix the build errors and run again.

dotnet:

dotnet: watch : Exited with error code 1

dotnet: watch : Waiting for a file to change before restarting dotnet...

Please see the project here.

For some projects, the Security appears to work... For most others, it throws this error.

We couldn't reproduce the error by following the listed steps. I am attaching my test application which compiles and runs without errors. TestMultiTenancy.zip

If you have a Radzen Professional Subscription please send us your application to info@radzen.com and we will troubleshoot.

I do own a Professional subscription... I've sent an email.

Please download the example project I created which exemplifies the error.

We can't download the linked project.

We have requested access. By the way I have attached the results of doing the listed steps which compiles are runs OK. Did you try that version? Does it compile at your side?

Let's step back.... and look at the problem.

I have several newly created projects that will not compile.

They all have the same error as I listed above.

So, this is not limited to a single project. It is an ongoing issue that needs to be addressed in Radzen.

I've enabled access to the zip for info@radzen.com.

Please let me know if you need more information.

I think the problem is that the app name and data source have the same name - Test. Radzen uses the application name as the root namespase and the data source's name - for the model's namespace. As a result the following code is generated:

using Test.Models;

namespace Test.Controllers

The using Test.Models statement brings the Test.Models.Test namespace into scope. As a result the compiler now thinks that Test.Controllers is actually Test.Models.Tests.Controllers.

Anyway we will add a validation in Radzen to no longer allow such cases. From now on users won't be able to create a data source with the same name as the application.