r/csharp • • 17m ago

Help What happens to the expression that is passed to Debug.Assert() on Release?

• Upvotes

If I understand it correctly, when you write Debug.Assert(value) it's only included if debug mode is enabled, but not when it's release mode. So, what happens if I pass an expression as the argument to this method? Let's say it's a function call, would it be executed on release mode? Or should this: Debug.Assert(ImportantFuncWhichReturnsBool()); Become this: bool value = ImportantFuncWhichReturnsBool(); Debug.Assert(value); Thanks in advance


r/csharp • • 1h ago

Showcase Forget v2.4 – CRUD, upsert and multi-row writes on top of Dapper, with the right SQL for MySQL, Oracle, PostgreSQL and SQL Server

Thumbnail
2 Upvotes

r/csharp • • 5h ago

I built HttpResponseTransformer to make it easier to rewrite HTTP responses

Thumbnail
2 Upvotes

r/csharp • • 16h ago

Tool Duack - a dependency-free C# audio library for MonoGame, KNI and FlatRedBall2 (desktop + WebAssembly)

Thumbnail
2 Upvotes

I'd like to hear what you currently use for audio in C# FMOD, Wwise, raw XACT/wrappers, and what annoys you about it, especially if you target WebAssembly.


r/csharp • • 10h ago

Help Roadmap to become a c# web developer

0 Upvotes

What's the roadmap of become web developer in a c# . Is it worth learning in this AI era.


r/csharp • • 2h ago

Help My post keeps getting deleted by reddit's filters

0 Upvotes

I've made this post: https://www.reddit.com/r/csharp/comments/1xhmfnf/any_good_crossplatform_windows_macos_linux_c_gui/ but it keeps getting deleted, what am I doing wrong??


r/csharp • • 11h ago

Help SAP B1 DI API Company.Connect() returns -226 "The specified resource name cannot be found in the image file"

0 Upvotes

Hi all, I'm trying to diagnose a SAP Business One DI API connection error and would appreciate any insights.

Setup

  • SAP B1: Version 9.x
  • Application: .NET Windows Service
  • DI API: Late-bound COM via Type.GetTypeFromProgID("SAPbobsCOM.Company")
  • Threading: STA
  • Process: 64-bit

I'm setting the following properties before calling Connect():

  • Server (IP)
  • CompanyDB
  • UserName
  • Password
  • DbServerType
  • LicenseServer (Usually defaults to same with server)
  • UseTrusted = false

Problem

  • The ProgID resolves successfully, and the COM object is created.
  • Company.Connect() returns -226.
  • GetLastErrorDescription() returns: The specified resource name cannot be found in the image file.
  • Subsequent calls throw a COMException (0xFFFFFF96) with the message: You are not connected to a company

I had once achieved a connection against another database, can't seem to point out what the outstanding issue now is.

Any pointers to the specific cause or recommended troubleshooting steps would be appreciated. Thanks!