Forum Widgets
Latest Discussions
- Eduard KeilholzNov 03, 2021Copper Contributor18KViews1like27Comments
How do I convert the C# .dll file to .so file
Requirements: I wrote a standalone module (a separate dll file) in C#, mainly through COM real-time monitoring of a hardware, based on Win7 system. Originally to WPF program call, now Android system app also call this dll file. The application scenario is that a hardware device is connected to an Android tablet, on which an app will call my library files to monitor the hardware. There is no network. The plan is to throw the files directly to Android developers, who will directly call the interface in the files to communicate with the hardware. What is the best way for Android developers to use dll files, wrap them with other layers or rewrite them in another language 需求:我用C#语言写了一个独立模块(单独一个dll文件),主要是通过COM口实时监控一个硬件,基于Win7系统写的。原来是给WPF程序调用的,现在是安卓系统上app也要调用这个dll文件。应用场景是一个硬件设备上连着一个安卓平板,平板上有一个app要调用我的库文件监控硬件,没有网络,计划是将文件直接丢给安卓开发人员,安卓开发人员直接调用文件里的接口与硬件通讯。哪种方式能更好的使安卓开发人员使用dll文件,外面用其他需要封装一层还是用其他语言重新写BeiBeiHeMar 01, 2023Copper Contributor12KViews0likes7CommentsC# Directory.Exists is false positive
.NET6 Noticed some curiosity: System.IO.Directory.Exists("\\server\somefolder") returns true also a File.Move was successfully performed to this folder and the Files are moved into nirvana without any Exception. Yes in Fact \\ did not work and my solution was \\\\ for the correct network path... But is there any deeper meaning in this behavior? Thx for some hints @any Developer BuddyLordLeekDec 16, 2021Copper Contributor2.6KViews0likes0Commentshow to prevent password replay attack in . Net
Hi, We need some help in how to prevent password replay attack in . Net and also in how to prevent passing of encryption key along with encrypted password. Please advise. Thanks and Regards, SuparnaSUPARNA KANSAKARJul 25, 2022Brass Contributor2.5KViews1like4CommentsThe most interesting C# / .NET blogs and websites
Let's take a look at the list of information sources that can be useful for the C# / .NET developers. Our list includes blogs, repositories with source code, standards and accounts of developers who covers the deep aspects of the C# and .NET. Blogs .NET Blog Link: https://devblogs.microsoft.com/dotnet/ It's an official blog from Microsoft about .NET, and languages and technologies related to this platform. Do you want to know about https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-6/? Or maybe you want to see https://devblogs.microsoft.com/dotnet/whats-new-in-fsharp-6/? Would you like to read about https://devblogs.microsoft.com/dotnet/welcome-to-csharp-10/? You are welcome! .NET Core Tutorials Link: https://dotnetcoretutorials.com/ I'm not a regular reader of this blog. However, I want to recommend it to you. There was a time when I could find useful information on the topic of security there (about the OWASP Top 10 and C#). In my opinion, you can also find something interesting / useful there. Programming stuff Link: http://sergeyteplyakov.blogspot.com/ This is the blog of https://twitter.com/STeplyakov, who is currently working at Microsoft. The blog is only in Russian and has not been updated for a long time, but there is a lot of interesting material in it. So, if you have not heard about this blog and your language proficiency allows you to get familiarize with it, don't miss the opportunity. Habr.com Link (C# hub): https://habr.com/ru/hub/csharp/ Link (.NET hub): https://habr.com/ru/hub/net/ It's a good source of technical articles. The website is especially popular in the Russian-speaking community. This website has an English version (C# hub: https://habr.com/en/hub/csharp/, .NET hub: https://habr.com/en/hub/net/), but there are fewer articles published there. Again, if the knowledge of language allows you to read articles in the original, I recommend reading the Russian version of website. PVS-Studio blog Link: https://pvs-studio.com/en/blog/posts/csharp/ Let me introduce you to our blog. Here, you can find articles on various topics: on code quality, on bugs found in open-source projects, on the specifics of C# / .NET. Here are some examples of publications: https://pvs-studio.com/en/blog/posts/csharp/0865/ https://pvs-studio.com/en/blog/posts/csharp/0852/ The sources of .NET You can't do without source files when you want to better understand what is happening "under the hood" of a particular system. For example, do you want to improve your understanding of how types from the standard library work? The source code of https://referencesource.microsoft.com/ and https://github.com/dotnet/runtime will help you to do that. Do you want to dig deeper into the compiler? No problem - here is the https://github.com/dotnet/roslyn at your service. Do you need to look inside the build system? Here you go - the https://github.com/dotnet/msbuild code is also open-source. By the way, if you are interested in build processes, you may also find https://msbuildlog.com/ useful. It's a tool that allows you to work with MSBuild build logs in a convenient format. If you want to know about other components of .NET: NuGet, ASP.NET Core, Entity Framework Core or something else - it's worth looking for sources in https://github.com/dotnet. Standards Sometimes, the source code is not enough and you have to dig deeper into the https://github.com/dotnet/runtime/blob/main/docs/project/dotnet-standards.md. I especially like the standard that defines https://www.ecma-international.org/publications-and-standards/standards/ecma-335/. It can be handy when you want to better understand what is happening in the IL code. https://en.wikipedia.org/wiki/List_of_CIL_instructions may be also useful. It can refresh your memory if you have forgotten something. Twitter accounts I suddenly discovered Twitter from a new angle. This is both a source of useful and interesting information, and a place where you can ask / discuss something. It's a platform where people will help you or explain you something. Let me show you a few Twitter accounts that I follow. Maybe you will find them interesting as well: https://twitter.com/badamczewski01 https://twitter.com/okyrylchuk https://twitter.com/konradkokosa https://twitter.com/EgorBo https://twitter.com/maoni0 You can also follow https://twitter.com/_SergVasiliev_, so you won't miss anything interesting. 😉 Conclusion I hope this article helped you find some new sources of useful information. Where do you check out the latest news and updates? Please, share in the comments! Who knows, maybe you will help someone discover new platform that they needed so badly._SergVasiliev_Jan 06, 2022Copper Contributor2.2KViews1like0CommentsProblems with .Net 6 and excel VBA
Hi, ive setup a project that uses .Net 6 and is call from excel VBA. Some of the functions work fine but others are not. Its really not clear to me why they dont work. The interface; namespace COMThermoClass { [Guid(ContractGuids.ServerInterface)] [ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IThermo { double TestCritT(); // double LiqEnthalpyReal(object comps, object X, double T, double P, int method); double StreamEnthalpyReal(object comps, object X, double T, double P, int method); double StreamTemperatureReal(object comps, object X, double H, double P, int method); double CritP(double Tb, double SG, int method); double CritT(double Tb, double SG, int method); double DistillationPoint(object comps, object X, object SG, object BP, int method, string DistType, string distpoint); double EnthalpyFormationReal(object comps, object X); double LiqComponentEnthalpy(string comp, double T, double P, int method); // double VapComponentEnthalpy(string comp, double T, double P, int method); } } The class; namespace COMThermoClass { [Guid(ContractGuids.ServerClass)] [ClassInterface(ClassInterfaceType.None)] [ComVisible(true)] public partial class COMThermoClass : IThermo { private enumCalcResult cres; public COMThermoClass() { Thermodata data = new Thermodata(); } public double TestCritT() { //Debugger.Launch(); return 99.9; } } } som function are in other files such as; public partial class COMThermoClass { public double LiqComponentEnthalpy(string comp, double T, double P, int method) { Debugger.Launch(); double res = 0; BaseComp sc = Thermodata.GetRealComponent((string)comp); sc.molefraction = 1; Components cc = new Components(); cc.Add(sc); cc.T = T; cc.P = P; cc.thermo.Enthalpy = (enumEnthalpy)method; res = ThermodynamicsClass.BulkStreamThermo(cc, cc.P, T, enumMassOrMolar.Molar, enumFluidRegion.Liquid, ref cres).H; return res; } public double StreamEnthalpyReal(object comps, object X, double T, double P, int method) { double res; Components cc = new Components(); cc.T = T; cc.P = P; BaseComp sc; // Debugger.Launch(); string[] c = (string[])comps; double[] x = (double[])X; double sum = 0; for (int i = 0; i < x.Length; i++) { sum += x[i]; } if (sum != 1) // normalise { for (int i = 0; i < x.Length; i++) { x[i] /= sum; } } cc.thermo.Enthalpy = (enumEnthalpy)method; for (int i = 0; i < x.Length; i++) { sc = Thermodata.GetRealComponent(c[i]); if (sc == null) { System.Windows.Forms.MessageBox.Show("Component " + c[i].ToString() + "Not Found In Database"); } else { sc.molefraction = x[i]; cc.Add(sc); } } BasicPropList bpl = new BasicPropList(); bpl.T.BaseValue = T; bpl.P.BaseValue = P; bpl.T.origin = SourceEnum.Input; bpl.P.origin = SourceEnum.Input; FlashClass.Flash(cc, bpl, false); res = cc.BulkEnthalpy(); return res; } public double StreamTemperatureReal(object comps, object X, double H, double P, int method) { double res; Components cc = new Components(); cc.P = P; BaseComp sc; //Debugger.Launch(); string[] c = (string[])comps; double[] x = (double[])X; double sum = 0; for (int i = 0; i < x.Length; i++) { sum += x[i]; } if (sum != 1) // normalise { for (int i = 0; i < x.Length; i++) { x[i] /= sum; } } cc.thermo.Enthalpy = (enumEnthalpy)method; for (int i = 0; i < x.Length; i++) { sc = Thermodata.GetRealComponent(c[i]); if (sc == null) { System.Windows.Forms.MessageBox.Show("Component " + c[i].ToString() + "Not Found In Database"); } else { sc.molefraction = x[i]; cc.Add(sc); } } BasicPropList bpl = new BasicPropList(); bpl.H.BaseValue = H; bpl.P.BaseValue = P; bpl.H.origin = SourceEnum.Input; bpl.P.origin = SourceEnum.Input; FlashClass.Flash(cc, bpl, false); res = cc.T; return res; } public double StreamComponentEnthalpy(string c, double T, double P, int method) { double res; Components cc = new Components(); cc.T = T; cc.P = P; BaseComp sc; cc.thermo.Enthalpy = (enumEnthalpy)method; sc = Thermodata.GetRealComponent(c); if (sc == null) { System.Windows.Forms.MessageBox.Show("Component " + c.ToString() + "Not Found In Database"); } else { sc.molefraction = 1; cc.Add(sc); } BasicPropList bpl = new BasicPropList(); bpl.T.BaseValue = T; bpl.P.BaseValue = P; bpl.T.origin = SourceEnum.Input; bpl.P.origin = SourceEnum.Input; FlashClass.Flash(cc, bpl, false); res = cc.BulkEnthalpy(); return res; } } The IDL file [ uuid(A5996396-7DB2-44B4-BD98-4D769792DE2D), version(1.0), custom(90883F05-3D28-11D2-8F17-00A0C9A6286C, "COMThermo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") ] library COMThermo { // TLib : mscorlib.dll : {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D} importlib("mscorlib.tlb"); // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} importlib("stdole2.tlb"); // Forward declare all types defined in this typelib interface ICOMThermo; [ odl, uuid(B221E497-C862-4C40-B4E6-5D79E7AB28D5), version(1.0), oleautomation, custom(B10B0742-6D84-415D-894C-798ED2D76C1D, "COMThermo.ICOMThermo") ] interface ICOMThermo : IUnknown { [id(0x60020000)] HRESULT _stdcall TestCritT([out, retval] double* pRetVal); [id(0x60020001)] HRESULT _stdcall StreamEnthalpyReal( [in] VARIANT comps, [in] VARIANT X, [in] double T, [in] double P, [in] long method, [out, retval] double* pRetVal); [id(0x60020002)] HRESULT _stdcall StreamTemperatureReal( [in] VARIANT comps, [in] VARIANT X, [in] double H, [in] double P, [in] long method, [out, retval] double* pRetVal); [id(0x60020003)] HRESULT _stdcall LiqEnthalpyReal( [in] VARIANT comps, [in] VARIANT X, [in] double T, [in] double P, [in] long method, [out, retval] double* pRetVal); [id(0x60020004)] HRESULT _stdcall LiqComponentEnthalpy( [in] BSTR comps, [in] double T, [in] double P, [in] long method, [out, retval] double* pRetVal); }; [ uuid(BE532448-9A5A-4273-B93C-0573545D36C4), version(1.0), custom(B10B0742-6D84-415D-894C-798ED2D76C1D, "COMThermo.COMThermo") ] coclass COMThermo { interface _Object; [default] interface ICOMThermo; }; }; The Excel VBA Dim test As New COMThermo.COMThermo Function Test1() Test1 = test.TestCritT() End Function Sub LiqComponentEnthalpy() Dim res As Double res = test.LiqComponentEnthalpy("n-Butane", 25 + 273.15, 1#, 5) 'End Function End Sub Function StreamEnthalpy(comp As Range, Xfractions As Range, T As Double, P As Double, Method As Integer) As Double Dim Names() As String Dim x() As Double No = comp.Cells.Count ReDim Names(No - 1) ReDim x(No - 1) For i = 1 To No Names(i - 1) = comp(i).Value x(i - 1) = Xfractions(i).Value Next StreamEnthalpy = test.StreamEnthalpyReal(Names, x, T + 273.15, P, Method) 'End Function End Function When i run the VBA TestTcrit works fine as does StreamEnthalpy but LiqComponentEnthlapy give an error saying "Runtime error -2147467261 "Object Reference not set to an instance of an object". Any possible deas why?SilverShadedJan 16, 2022Copper Contributor1.3KViews0likes1CommentThe Importance of Finding the Right Bra Size
Finding the right goldies bra size is one of the most important things you can do when shopping for a new bra. If your bra does not fit you correctly, you’re not only going to be uncomfortable, but you’re also going to end up with unsightly lines, straps digging into your skin, and a bra that isn’t lifting you to your fullest potential. https://fullfly.net/goldies-bra-reviews/ While this may not seem like a big deal when you’re just wearing the bra by itself, it becomes much more noticeable when you’re wearing a shirt or other top. If you’re trying to find your perfect bra size, be sure to take all of your measurements. This includes the circumference of your bust, the length of your torso, and your bra size. Keep in mind that bra sizes are not just measurements of the cups. There are other parts of the bra that need to be measured and checked to ensure the correct size.Donald589Aug 29, 2022Copper Contributor1.3KViews0likes2CommentsNeed suggestion on learning C# for AZ-204 exam
Hi All, I am a sysadmin and I am looking to start the certification track of Azure Developer. I code in PowerShell and also know basics of C# programming. Can anyone suggestion any good resource to learn C# specific to Azure Developer (AZ-204) certification exam. Regards, Ashish AryaAshish_AryaDec 20, 2022Brass Contributor1.3KViews0likes2CommentsThe new C# code generators at work
If you struggled with INotifyPropertyChanged implementation in C#, you may like my new C# Code Generator (C# 9.0) generating the property implementation in a partial class (see docs). This new strategy for generating code is important because it generates the code in real-time in Visual Studio but also when compiling from the CLI. Also, they do not require no runtime dependency, as everything is just done at build time. https://www.nuget.org/packages/SpeedyGenerators/ Sources and docs here: https://github.com/raffaeler/SpeedyGenerators HTH1.2KViews2likes0Comments