Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Couple of issues when switching to version 11.0.1 #10806


User avatar
0
kylem created
  • What is your product version? 11.0.1
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? 6.0

1. Issue with Timestamp fields in PostgreSQL

Hi, I tried today migrating to latest version of the framework (11.0.1) end there are couple of issues

We are usign PostgreSQL as a DB. After switching to .NET core 6.0 I also upgraded Npgsql.EntityFrameworkCore.PostgreSQL to version 6. When I started aspnet-core part, I got error:

InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported

I was able to get around the issue by adding this into Configure() method of Startup.cs but I am not sure if this is correct way to do it.

    // workaround for issue when switched to .NET 6.0: 'InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported'
    // solution found here: https://stackoverflow.com/questions/69961449/net6-and-datetime-problem-cannot-write-datetime-with-kind-utc-to-postgresql-ty
    AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

2. Links that suppose to open in new tab do not work in Default Theme, but work in Theme 2

One of the Menu items we added is link to external web page that opens in new tab. To achieve this we set externalLink to true in AppMenuItem:

new AppMenuItem('Helpdesk - New Tab', 'Pages.Tenant.Helpdesk.InNewTab', 'flaticon-book', 'https://EXTERNAL_URL_HERE', [], [], true)

Nothing happens when this menu item is clicked. Nothing is recorded in Console as well.

However, if I pick 'Theme 2', external link is correctly opened in new link. Can you please take a look and advice if this is right way to achieve opening external URL in a new tab.

Another minor issue is that although I downloaded version 11.0.1, version strings in the app still say: 11.0.0

Thanks and Regards, Predrag


2 Answer(s)
  • User Avatar
    0
    kylem created

    In the meanwhile I managed to get around issue #2 by changing external link opening functionality in side-bar-menu.component.html like this:

    <a
                *ngIf="!item.items.length && item.external"
                href="#"
                (click)=openInNewTab(item.route)
                class="menu-link menu-toggle"
            >
                <ng-container
                    [ngTemplateOutlet]="mMenuItemText"
                    [ngTemplateOutletContext]="{ item: item, parentItem: parentItem }"
                ></ng-container>
            </a>
    

    ... and defining openInNewTab() method in side-bar-menu.component.ts:

    openInNewTab(url) {
            window.open(url, '_blank').focus();
        }
    

    However It is still not clear to me why the existing functionality to opening external links in side-bar-menu.component.html won't work, and at the same time, very similar code in top-bar-menu.component.html works fine. Anyhow, hopefully you guys can provide some insight.

    Also, one more issue found:

    3. Dockerfile.original in aspnet-core stil references aspnet 5.0

    It worked fine when I changed it to 6.0

    Thanks and Regards, Peja

  • User Avatar
    0
    musa.demir created

    Hi kylem

    Thanks for the explanation. I created the issues. You can follow the progress here:: https://github.com/aspnetzero/aspnet-zero-core/issues/4178 https://github.com/aspnetzero/aspnet-zero-core/issues/4179 https://github.com/aspnetzero/aspnet-zero-core/issues/4180