Recent Discussions
Connection between .NET and AUTOCAD ELECTRICAL
I want to connect .NET with Autocad Electrical . i am using , AutoCAD Electrical 2025.0.2 , Product Version : 22.0.81.0 , Built on: V.154.0.0 AutoCAD 2025.1.1 Visual Studio Community 2022 - 17.12.3 my system is x64 bit I am creating a console application in .NET 8.0 Runtime with C# language , Added dll accoremgd , acdbmgd, acmgd, Autodesk.AutoCAD.Interop . Also in .NET in Solution Explorer , in project references , i have made "Copy Local" property as False. using System; using Autodesk.AutoCAD.Interop; using Autodesk.AutoCAD.Runtime; using System.Runtime.InteropServices; using Autodesk.AutoCAD.ApplicationServices; namespace AutoCADElecDemo { class Program { static void Main(string[] args) { AcadApplication acadApp = null; const string progId = "AutoCAD.Application.25"; // Adjust for your AutoCAD version try { // Get a running instance of AutoCAD acadApp = GetActiveAutoCAD(progId); } catch (System.Exception ex) { Console.WriteLine($"Error initializing AutoCAD: {ex.Message}"); return; } try { // Ensure AutoCAD is visible acadApp.Visible = true; Console.WriteLine("AutoCAD is now running."); // Register for the BeginQuit event Application.BeginQuit += OnBeginQuit; // Keep the application running to monitor AutoCAD's state Console.WriteLine("Press Enter to exit..."); Console.ReadLine(); } catch (System.Exception ex) { Console.WriteLine($"An error occurred: {ex.Message}"); } finally { // Unregister the event handler before exiting Application.BeginQuit -= OnBeginQuit; } } static AcadApplication GetActiveAutoCAD(string progId) { try { var comObject = Marshal.GetActiveObject(progId); Console.WriteLine($"Connected to AutoCAD: {progId}"); return (AcadApplication)comObject; } catch (System.Exception ex) { Console.WriteLine($"Error accessing AutoCAD: {ex.Message}"); throw; } } static void OnBeginQuit(object sender, EventArgs e) { Console.WriteLine("AutoCAD is being closed."); } } } For above code, my application comes in break mode "Your app has entered a break state, but no code is currently executing that is supported by the selected debug engine (e.g. only native runtime code is executing)." and i am getting below error : System.IO.FileNotFoundException: 'Could not load file or assembly 'accoremgd, Version=25.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.' dll path is also correct. i also tried same code with .NET Framework 4.7.2 and 4.8 targeting pack , but getting same error. How to load accoremgd.dll properly so that this application can use autocad accoremgd functions properly.82Views0likes1CommentHelp with my ASP.NET API Application
I have been developing API for a full stack application with React FrontEnd in ASP.NET for my Internship project which is an Asset Management System. I have successfully implemented API Endpoints for CRUD with Authentication with JWT. What topic should I learn next ? Should I start providing API Documentation or is there something else I need to learn ? I have also uploaded the Schema the project is using. I am using ADO.NET instead of Entity Framework for quering with the database. The link to my Repository Source Code: https://github.com/bibashmanjusubedi/Internship18Views0likes0CommentsSingleton Class with Async
I'm working on building a Blazor Web App (.net 9) for an internal company portal. I want to load some persistent data to be used throughout the app into a class and then load that class as a scoped service. Most of the data will be fairly static, but expensive data to retrieve, ie: graph api call for members of groups, etc. So that data will also be loaded asynchronously. Everything I've found regarding loading data into a class asynchronously basically points back to a post by Stephen Cleary on Asynchronous Lazy Initialization: https://blog.stephencleary.com/2012/08/asynchronous-lazy-initialization.html My question is, given that this post was originally posted back in 2012, is this still an acceptable way of loading data asynchronously for a singleton or are there other, more modern approaches to this scenario?8Views0likes0CommentsApplications are not correctly detecting .NET Desktop Runtime 6.0.1 (x64)
Even though I have .NET Desktop Runtime 6.0.1 (x64) installed, I'm still getting an error when launching a .NET application Windows 10 21H2 OS Build 19044.1466 Event log shows event 1023 - Description: A .NET application failed. Application: HandBrake.exe Path: C:\Program Files\HandBrake\HandBrake.exe Message: Failure processing application bundle. Bundle header version compatibility check failed. A fatal error occured while processing application bundle8.6KViews0likes3Commentsaspnet c# iterate control in listview and remove a panel from placeholder in one column
trying to iterate through controls in listview to remove panel01 from placeholder if detected row in database condition dt.Rows[i]["BidEndWithError"].ToString() == "no" in the row: But all the listview's panel01 being removed even dt.Rows[i]["BidEndWithError"].ToString() == "no" is not 'no'`your text` `<asp:PlaceHolder ID="phLabel" runat="server"> <asp:Panel ID="panel01" runat="server"> Day Left : <%# Eval("BidDayLeft") %></br> Hour Left : <%# Eval("BidHourLeft") %></br> Minute Left : <%# Eval("BidMinuteLeft") %></br> Second Left : <%# Eval("BidSecondLeft") %></br> </asp:Panel> protected void lv01_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { string constr = ConfigurationManager.ConnectionStrings["bidsystemdb"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { DataTable dt = new DataTable(); //string strSQL = "Select * from BidTable2 WHERE ProductName='Toy 1'"; string strSQL = "Select * from BidTable2"; SqlDataAdapter adpt = new SqlDataAdapter(strSQL, con); adpt.Fill(dt); for (int ij = 0; ij < e.Item.Controls.Count; ij++) { for (int i = 0; i < dt.Rows.Count; i++) { //Response.Write("lv01 reached!"); if (dt.Rows[i]["BidEndWithError"].ToString() == "no") { Response.Write("lv01 level 2 reached!"); PlaceHolder _phLabel = e.Item.Controls[ij].FindControl("phLabel") as PlaceHolder; Panel _pnlLabel = e.Item.Controls[ij].FindControl("panel01") as Panel; _phLabel.Controls.Remove(_pnlLabel); ContentPlaceHolder _MainContent = Master.FindControl("MainContent") as ContentPlaceHolder; UpdatePanel _udp01 = _MainContent.FindControl("udp01") as UpdatePanel; _udp01.Update(); } } } } } }`11Views0likes0Comments_EnumDesktopWindows API problem
_EnumDesktopWindows API which uses User32.dll stopped working when the patch having OS build number 26100.3775 was updated on Windows 11. The version which was thus installed for Windows 11 is 24H2. It happen also on windows 2019 server having 24H2 as version number. When it tries to get a windows handle of a FORM, it freezes and doesn't allow the user to do anything. What seems to be the problem & how this can be rectified? Anyone's help will be deeply appreciated. Thanks...17Views0likes0CommentsUsing late binding to run AdvancedSearch in Outlook in .NET8?
I'm trying to use the AdvancedSearch feature from Outlook in my .NET 8 application, but I haven't been able to make it work. I'm currently using Restrict when I need to filter by a specific sender or by date. However, I need more advanced filtering options — for example, checking if the subject contains a specific word. I could use a loop to do this after retrieving the results with Restrict, but it's very slow. It seems like AdvancedSearch would be a better option, but I'm getting an error when I try to run the search. Below is an example of my code, although I've tried many variations. If anyone can share a working example, that would be really helpful. Thanks in advance! string searchTag = "BuscaOutlook"; string searchScope = "'\\Caixa de Entrada'"; filter = "@SQL=\"urn:schemas:httpmail:subject\" LIKE '%orcamento%' AND \"urn:schemas:httpmail:datereceived\" >= '2024-04-01 00:00:00'"; try { dynamic searchb = outlookApp.AdvancedSearch(searchScope, filter, true, searchTag); } catch (Exception ex) { MessageBox.Show("Erro no AdvancedSearch:\n" + ex.Message); return; }46Views1like1CommentMicrosoft Store Service APIs v9.0 publisherQuery - Uniquely identifying user subscription
I'm working on a WPF app that will be published to the Windows Store. It supports an add-on monthly subscription. That subscription comes with consumable credits for using my app. Per user, per month, I want to track the user's credit balance. I'm using the following Microsoft Store Service API endpoint to get the user's subscription details from my backend service: collections.mp.microsoft.com/v9.0/collections/publisherQuery Here's an example response (with identifying information replaced with fake data): { "ContinuationToken": null, "Items": [ { "RecurrenceId": null, "AcquiredDate": "2025-04-28T20:34:54.2761169+00:00", "AcquisitionType": "Recurring", "EndDate": "2025-05-31T00:00:00+00:00", "Id": "11111111111122222222222333333333", "ModifiedDate": "2025-04-28T20:34:54.277868+00:00", "ProductId": "AAAAAAAAAAAA", "ProductKind": "Durable", "Quantity": 1, "SatisfiedByProductIds": [], "SkuId": "0020", "StartDate": "2025-04-28T00:00:00+00:00", "Status": "Active", "Tags": [], "TransactionId": "11111111-1111-1111-1111-111111111111", "TrialData": { "IsInTrialPeriod": false, "IsTrial": false, "TrialTimeRemaining": "00:00:00" } } ] } Based on this response, I can see there's an active subscription, with the start and end date. I'm trying to determine whether anything in this response uniquely represents this user's subscription for this month, and could be used as my own identifier when tracking user credit consumption. It looks like Id and TransactionId are the only two potential candidates, but I don't know for certain that I can count on either of these for this scenario. Can anyone confirm? Is there some altogether better approach I should be using?10Views0likes0CommentsImplementation SMTP using MailKit in ASP .NET Core MVC
I am developing a web development project, where I have to implement email trigger along with message. Suppose there is a form where users will put thier name, email, title and message. After hitting submit button it will automatically send the message to the owner. How can I achieve this in latest version of this framework. And MailKit is Version 4.11.0.25Views0likes0CommentsAacAmbientLighting.exe Issue
Hi, I'm not sure if this is an appropriate place to post this, please do let me know if not. I have for the last two days been getting the following message popping up on my machine and I can't work out for what reason. I updated my Internet Security during that time, so automatic thought was it was that preventing the files been read, but I've disabled the Internet Security and the error message still crops up I have also uninstalled and reinstalled Armoury Crate, uninstalling it does take the error away, but that causes other issues and I use ROG hardware. So I kind of need Armoury Crate to be functioning. This is the error that I'm seeing: When I try and install the .Net Runtime software it says that 'the specified account already exists' so I'm a littled confused as to what might be causing the issue and how I can resolve it and keep Armoury Crate on my machine.179Views0likes0CommentsEnable .Net ImageFormat.WebP in VS 2022 Prof ASPX Web.Config
Hi. I am developing C# ASPX Web sites in VS Professional 2022 (64 bit). I want to access the System.Drawing.Imaging.ImageFormat.WebP property so I can manipulate WebP files. I believe this requires .Net 4.8. I know there are 3rd party libraries out there - I would prefer to keep as much native MS code as possible. I am unable to get System.Drawing.Imaging.ImageFormat.WebP as a selection option for the ImageFormat. I can get all of the other formats e.g. TheImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg/Gif/Png etc. WebP is not shown as an option. I have Web.Config set as: <compilation optimizeCompilations="true" debug="true" targetFramework="4.8.1"> <assemblies> <add assembly="System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> </assemblies> </compilation> <httpRuntime targetFramework="4.8.1" executionTimeout="240" maxRequestLength="20480" requestValidationMode="2.0" /> The Targeting Packs & SDK seem to be installed & enabled as per the screen snap below. Any help in resolving this is greatly appreciated. Many thanks, Peter.37Views0likes0CommentsBuild Scalable Web Apps and APIs with ASP.NET Core, Blazor, Angular for Modern Web Apps
I’m starting this discussion because many developers today need guidance on how to build modern, scalable web applications and APIs by combining ASP.NET Core, Blazor, and Angular—three powerful technologies within the .NET ecosystem. Whether you're focused on server-side development, creating dynamic client-side apps, or integrating both, these frameworks provide incredible capabilities to enhance your projects ASP.NET Core for API Development: ASP.NET Core is a robust, high-performance framework that allows you to create powerful APIs. Some of the best practices we’ll cover include: - Designing RESTful APIs with ASP.NET Core - Utilizing Entity Framework Core for efficient database access - Securing APIs with JWT and OAuth - Handling asynchronous requests for optimal performance - Implementing API versioning and changes over time Building Dynamic Web Apps with Blazor: Blazor enables you to create interactive web applications using C# instead of JavaScript. We will discuss: - Blazor Web Assembly vs. Blazor Server: Differences and use cases - Creating reusable Blazor components for UI - Integrating third-party JavaScript libraries with Blazor - Using SignalR for real-time features - Optimizing Blazor for performance Angular for Full-Featured Client-Side Development: Angular is a powerful, full-featured front-end framework that excels in creating dynamic and complex user interfaces. In this section, we'll dive into: - Why you might choose Angular over Blazor in certain cases - Using Angular CLI to scaffold, build, and maintain apps - Managing state in Angular with NgRx or RxJS - Connecting Angular with ASP.NET Core APIs for data handling - Working with Angular components, services, and routing for a seamless user experience Combining Angular and Blazor in a Single Application: You may have use cases where you want to combine both Blazor and Angular in one application to leverage the strengths of each framework: - When to use Angular for complex frontend features (e.g., dynamic forms, complex data visualization) and Blazor for simpler components or backend-heavy apps. - Managing communication between Angular and Blazor components in a single page (e.g., using - JavaScript Interop to pass data between the two). - Handling authentication and state management across both frameworks. Integration between Frontend (Blazor/Angular) and Backend (ASP.NET Core): No matter whether you're using Angular or Blazor for the frontend, integrating these with your backend API is key. We'll discuss: - Setting up HttpClient for making API calls from both Blazor and Angular - Working with SignalR to enable real-time features in both frontends - Managing authentication and authorization across both Angular and Blazor (JWT, OAuth) - Best practices for passing data and sharing state between the frontend and backend Scalable and Maintainable Web Apps: When building full-stack web applications, it's important to focus on scalability and maintainability. Here are some practices for achieving this: - Structuring your application code to separate concerns (e.g., services, components, repositories) - Utilizing Dependency Injection for flexible and testable code - Modularizing your codebase for easier updates and maintenance - Using Lazy Loading for Angular and Blazor components to improve performance - Leveraging Caching strategies to enhance response times Testing and Continuous Deployment: For any modern application, testing and deployment are crucial. We’ll discuss: - Unit and integration testing in ASP.NET Core, Blazor, and Angular - Automated end-to-end testing (e.g., with Cypress for Angular, bUnit for Blazor) - Continuous Integration/Continuous Deployment (CI/CD) strategies for seamless deployment to cloud platforms like Azure or AWS When to Choose Angular, Blazor, or Both: It’s essential and interesting to know when to use each of these frameworks depending on your project’s needs. Some scenarios we’ll explore: - When to go for Blazor for a unified C# experience in both frontend and backend - Why you might opt for Angular when building highly interactive, feature-rich web applications - Hybrid approaches where you can use Blazor and Angular together for a robust full-stack solution SO: Combining ASP.NET Core, Blazor, and Angular allows developers to choose the right tool for the right job, creating flexible, scalable, and maintainable web applications. Whether you’re leveraging Blazor for its deep integration with .NET or Angular for its powerful frontend capabilities, these technologies offer a powerful suite of tools to build modern web applications. What are your thoughts? How have you integrated Angular or Blazor with ASP.NET Core in your projects? Share your experiences and challenges, and let's collaborate on solutions!288Views8likes2CommentsMYSYS2 Installation Guide for Cross-Compilation on Visual Studio 2017, 2019, 2022, and WSL2
Use Notepad to create this file on your desktop or another folder: MYSYS2.txt MYSYS2 Paths: Use Notepad to create this file on your desktop or another folder: MYSYS2_Path_Win.txt NOTE: This folder layout, which can be easily edited, was generated with a batch file that utilizes the default configuration that comes with the UI-based setup program / installer. Use Notepad to create this file on your desktop or another folder: Generate_MYSYS2_Folder_Paths_Win.bat36Views0likes0CommentsConvert the standard Blazor navigation menu to a collapsible icon menu
While I admittedly love Blazor I’ve always changed the out-of-the-box navigation menu that comes with it. It’s the first manoeuvre I pull when spinning up a new Blazor app, stripping out the purple gradient and getting it in, what I consider, a “blank slate state”. The other change I’ve wanted to make to the out-the-box look is one of those deluxe collapsible menus that leave just the icons showing. Anyone that’s used Azure DevOps will know what I’m talking about. I’ve included a picture to show DevOps example of what I’d like to see in my Blazor app. It gives a load of extra screen real estate which is always a priority for me in business applications particularly with complex or intensive workflows. Plus it gives the user the option to remove the text prompts once they are familiar with the system which is supported with carefully selected icon choices. As with most tasks that I assume will be an obvious solution I hit my search engine of choice and looked to avoid reinventing the wheel. However I found no source of pre-written changes to achieve this and was directed to fairly expensive third party controls to solve this one for me, which, being tight fisted, pushed me to do it for myself. Here I hope you save you the trouble of paying a pretty penny or having to wrestle the CSS into submission and provide a guide for producing a nice collapsible icon navigation menu by altering the existing out of the box menu in Blazor. In the following example I have left all the standard styling as is with the menu and just done the changes required to make the collapsible menu. The three files that require changes are MainLayout.razor, NavMenu.razor and NavMenu.razor.css. The code changes are shown below: Firstly the NavMenu.razor requires a bool value (IconMenuActive) to indicate whether the icon menu is showing or not, then wrap the text of the each NavItem in an if statement dependent on this bool. Then a method for toggling this bool and EventCalBack to send a bool to the MainLayout.razor for shrinking the width of the sidebar. Lastly there needs to be the control for switching menu views (I used the standard io icon arrows). NavMenu.razor <div class="top-row ps-3 navbar navbar-dark"> <div class="container-fluid"> <span class="oi oi-monitor" style="color:white;" aria-hidden="true"></span> @if (!@IconMenuActive) { <a class="navbar-brand" href="">The Menu Title Here</a> } <button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu"> <span class="navbar-toggler-icon"></span> </button> </div> </div> <div class="@NavMenuCssClass" @onclick="ToggleNavMenu"> <nav class="flex-column"> <div class="nav-item px-3"> <NavLink class="nav-link" href="" Match="NavLinkMatch.All"> <span class="oi oi-home" aria-hidden="true"></span> @if (!@IconMenuActive) { <label>Home</label> } </NavLink> </div> <div class="nav-item px-3"> <NavLink class="nav-link" href="counter"> <span class="oi oi-plus" aria-hidden="true"></span> @if (!@IconMenuActive) { <label>Counter</label> } </NavLink> </div> <div class="nav-item px-3"> <NavLink class="nav-link" href="fetchdata"> <span class="oi oi-list-rich" aria-hidden="true"></span> @if (!@IconMenuActive) { <label>Fetch data</label> } </NavLink> </div> </nav> </div> <div class="bottom-row"> <div class="icon-menu-arrow"> @if (!@IconMenuActive) { <span class="oi oi-arrow-left" style="color: white;" @onclick="ToggleIconMenu"></span> } else { <span class="oi oi-arrow-right" style="color: white;" @onclick="ToggleIconMenu"></span> } </div> </div> @code { //bool to send to MainLayout for shrinking sidebar and showing/hide menu text private bool IconMenuActive { get; set; } = false; //EventCallback for sending bool to MainLayout [Parameter] public EventCallback<bool> ShowIconMenu { get; set; } private bool collapseNavMenu = true; private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; private void ToggleNavMenu() { collapseNavMenu = !collapseNavMenu; } //Method to toggle IconMenuActive bool and send bool via EventCallback private async Task ToggleIconMenu() { IconMenuActive = !IconMenuActive; await ShowIconMenu.InvokeAsync(IconMenuActive); } } Next I add in a bit of CSS in to NavMenu.razor.css to put the arrow for toggling the menu at the bottom of the sidebar and a media query to make sure it doesn't show up in mobile view. The CSS classes added are .bottom-row and .icon-menu-arrow. NavMenu.razor.css .navbar-toggler { background-color: rgba(255, 255, 255, 0.1); } .top-row { height: 3.5rem; background-color: rgba(0,0,0,0.4); } .bottom-row { position: absolute; bottom: 0; padding-bottom: 10px; text-align: right; width: 100%; padding-right: 28px; } .icon-menu-arrow { text-align: right; } .navbar-brand { font-size: 1.1rem; } .oi { width: 2rem; font-size: 1.1rem; vertical-align: text-top; top: -2px; } .nav-item { font-size: 0.9rem; padding-bottom: 0.5rem; } .nav-item:first-of-type { padding-top: 1rem; } .nav-item:last-of-type { padding-bottom: 1rem; } .nav-item ::deep a { color: #d7d7d7; border-radius: 4px; height: 3rem; display: flex; align-items: center; line-height: 3rem; } .nav-item ::deep a.active { background-color: rgba(255,255,255,0.25); color: white; } .nav-item ::deep a:hover { background-color: rgba(255,255,255,0.1); color: white; } @media (min-width: 641px) { .navbar-toggler { display: none; } .collapse { /* Never collapse the sidebar for wide screens */ display: block; } } @media (max-width: 640px) { .bottom-row { display: block; } } Finally I add in the handler for the EventCallback to MainLayout.razor and a method to alter the width of the sidebar. MainLayout.razor @inherits LayoutComponentBase <div class="page"> <div class="sidebar" style="@IconMenuCssClass"> <NavMenu ShowIconMenu="ToggleIconMenu"/> </div> <main> <div class="top-row px-4"> <a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a> </div> <article class="content px-4"> @Body </article> </main> </div> @code{ private bool _iconMenuActive { get; set; } private string? IconMenuCssClass => _iconMenuActive ? "width: 80px;" : null; protected void ToggleIconMenu(bool iconMenuActive) { _iconMenuActive = iconMenuActive; } } The final product of these little changes are shown in the pictures below: I'd love to hear if anyone has tackled this in a different way to me and if they've got any ideas on making it cleaner. Have yourselves a wonderful day, Gav72KViews10likes16CommentsC# code causing XSS vulnerability
Hello, We get a vulnerability scan that is show that one of my pages is susceptible to a XSS attack. We are using a telerik tree view to display different data when the nodes are expanded. This is the information they reported back to me. Issue Detail The value of the scrollPosition JSON parameter within the ctl00_ContentPlaceHolder1_VIndex2_tvIndex_ClientState parameter is copied into the HTML document as plain text between tags. The payload sbi7s<script>alert(1)</script>tx52l was submitted in the scrollPosition JSON parameter within the ctl00_ContentPlaceHolder1_VIndex2_tvIndex_ClientState parameter. This input was echoed unmodified in the application's response. Request older1_VIndex2_tvIndex_ClientState=%7b%22expandedNodes%22%3a[]%2c%22collapsedNodes%22%3a[]%2c%22logEntries%22%3a[]%2c%22selectedNodes%22%3a[]%2c%22checkedNodes%22%3a[]%2c%22scrollPosition%22%3a%220**sbi7s%3cscript%3ealert(1)%3c%5c%2fscript%3etx52l**%22%7d&ctl00_RadWindowManager1_ClientState=&__ASYNCPOST=true&ctl00%24ContentPlaceHolder1%24VIndex2%24btnAddCart=Add%20To%20Cart Response > HTTP/2 200 OK > Cache-Control: no-cache > Pragma: no-cache > Content-Type: text/plain; charset=utf-8 > Expires: -1 > Server: Microsoft-IIS/10.0 > X-Powered-By: ASP.NET > X-Frame-Options: SAMEORIGIN > X-Ua-Compatible: IE=edge,IE=11,IE=10,IE=9,IE=8,IE=7 > Strict-Transport-Security: max-age=31536000 > Date: Wed, 19 Mar 2025 16:26:27 GMT > Content-Length: 82 > 68|error|500|0**sbi7s<script>alert(1)</script>tx52l** is not a valid value for Int32.| What is the best way to pinpoint this issue? How do I fix this so it isn't showing up on the scans?Solved86Views0likes3Comments.Net 8 Isolated upgrade issue- RPC Exceptions in .Net Core Function App
Hi Team, Need Immediate help. I am continuously receiving RPC Exceptions when I have upgraded my Function App to .Net 8 previously I had zero exceptions related to this in .Net 6. Scenario: We are creating builder with ConfigureFunctionsWebApplication() like below: 1. var builder = FunctionsApplication.CreateBuilder(args); 2. builder.ConfigureFunctionsWebApplication(); And basically, we have Http triggers and SB triggers in the application and only couple of them are facing issue and the error in AI states that this is an issue related to worker. I have copied multiple exception wrapped as an RPC exception below: 1. An exception was thrown by the invocation. Exception: System.TimeoutException: Timed out waiting for the function start call. 2. The operation has timed out at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.DefaultHttpCoordinator.SetFunctionContextAsync(String invocationId, FunctionContext context) 3.Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.DefaultHttpCoordinator.SetFunctionContextAsync(String invocationId, FunctionContext context) 4. Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 45 at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 96 Stack: at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.DefaultHttpCoordinator.SetFunctionContextAsync(String invocationId, FunctionContext context) in D:\a\_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\Coordinator\DefaultHttpCoordinator.cs:line 66 5. Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 45 at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 9646Views0likes0CommentsEmbedded Json being interpretted incorrectly
I created an API project in .NET 6.0 with an endpoint that accepts a Json request body with Json embedded in one of the attributes of the request. The problem I'm having is that within the embedded Json, one of the values has an escaped double quotes right before an open square bracket, and when the embedded Json is received by the endpoint, the escaped double quote is missing. Here is an example of how the end point is being called:POST /DataRequest/MyDataBody:{ "HostName": "my-host-01", "Job": "some_job", "JobData": "{\"attr1\":\"value1\",\"attr2\":\"value2\",\"attr3\";\"[val3] foo\"}" } The issue I see with JobData is that the \"[ after the attr3 definition gets immediately translated to just [. When I say Immediately, I mean that I have a break point on the very first line of the endpoint code and the escaped double quote is already removed from the JobData attribute.So, when I'm looking at the value that was received by the end point, it looks like this:"JobData": "{\"attr1\":\"value1\",\"attr2\":\"value2\",\"attr3\";[val3] foo\"}" This ends up being invalid Json and causes errors further down in the code. I tried to do some research on this, but it's pretty hard to google something like this and get any sort of answer. I did some experimenting and found that these combinations:\"attr3\":\"\"[val3] foo\" produces "attr3":"[val3] foo"\"attr3\":\" [val3] foo\" produces "attr3":" [val3] foo" (note, there's a space between the escaped double quote and the bracket)It seems like something in the framework is incorrectly assuming that the open bracket is starting a list even though it's got an escaped double quote in front of it. I also found that the sequence ]\" does the same thing on the other end where the escaped double quotes gets dropped in the string. Is \"[ and ]\" a special case escape that I'm just not aware of? Has anyone else run across this? We've kind of worked around the issue using the space between the escaped double quote and the open bracket, but I was hoping to find out why this happens. If I'm posting this in the wrong place, please let me know where I should post this.35Views0likes2CommentsBlazor server app closes without error during debugging
The application started in debug mode stops reacting unexpectedly, without errors being intercepted and/or exceptions being generated. I don't know if this behavior can also happen when starting in release mode. In practice, the web application stops reacting in the browser. However, if I pause the execution in Visual Studio, a message warns me that the debug has timed out because the underlying application is no longer running. The attempts I made to solve the problem are: I tried to hook the unhandled errors with: AppDomain.CurrentDomain.UnhandledException += (handling code) But unhandled errors are not intercepted. I tried to remove the automatic start of the browser when the app starts in order to disconnect the closing of the browser with the end of the execution of the application. It does not solve the problem. Notes: It is a Blazor server application, it uses .NET 9 (but even with .NET 8 I encountered the problem). I updated visual studio, and all the nughet packages connected to the application. The application, terminating without there being any clues as to the cause because the debugging does not stop anywhere, can no longer be fixed. Thanks I tried to catch unhandled errors, but it seems that the app does not close due to exceptions during execution (debugging does not catch errors). I use Edge browser. I tried to remove breakpoints from the code.30Views0likes0Comments.NET Core render modes
I moved my Blazor webassembly application form .NET 8 to .NET 9. Previously it was basicly two projects: Client (static webassembly content served in docker by nginx on port 5007 with API address set to port 5007) Server (database app with API on port 5009) and the typical usage was that I connect in the browser to port 5007, webassembly content was downloaded to the browser and display data gathered form the API on port 5007. After migration to .NET 9 I can no loger download web assemby package (connection reset), but instead everything is served on port 5009 (old webassemby content and API). Moreover everything is working considerably faster but I`m confused: Why and how it is even working (how content from client appear in the server)? Which render mode I`m using currently? Do I still need my second container with nginx? How should I clean my Startup.cs in the Server project after taht migration? namespace eTabelki.Server { public class Startup { readonly string CorsOrigins = "CorsOrigins"; public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite(Configuration.GetConnectionString("DefaultConnection"))); services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); services.AddControllersWithViews(); services.AddRazorPages().AddJsonOptions(options => { options.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.Preserve; options.JsonSerializerOptions.PropertyNamingPolicy = null; }); services.AddCors(options => { options.AddPolicy(CorsOrigins, builder => builder.WithOrigins("http://10.0.10.3:5007", "https://10.0.10.3:5008") .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); }); services.AddTransient<IGenerateInvoiceService, GenerateInvoiceService>(); services.AddTransient<IExportService, ExportService>(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebAssemblyDebugging(); using (IServiceScope scope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) { var context = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>(); context.Database.Migrate(); ApplicationDbContextExtensions.EnsureSeedData(context).GetAwaiter().GetResult(); ApplicationDbContextExtensions.EnsureSeedTemplates(context).GetAwaiter().GetResult(); } } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); using (IServiceScope scope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) { var context = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>(); context.Database.Migrate(); ApplicationDbContextExtensions.EnsureSeedTemplates(context).GetAwaiter().GetResult(); } } var cultureInfo = new CultureInfo("pl-PL"); CultureInfo.DefaultThreadCurrentCulture = cultureInfo; CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; app.UseHttpsRedirection(); app.UseBlazorFrameworkFiles(); app.UseStaticFiles(); app.UseRouting(); app.UseCors(CorsOrigins); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapControllers(); endpoints.MapFallbackToFile("index.html"); }); } } }27Views0likes0Comments