Vlad
Vlad
CC#
Created by Vlad on 9/18/2024 in #help
Using code generation to replace reflection, and Roslyn+Visual Studio performance.
Hey everyone, To better support trimming and AOT I'm shifting over some reflection code to code generation, which involves going over namespaces and types and generating functions to replace my usages of reflection. The generated code works and everything is fine, however it seems to me like Visual Studio's performance is way down and stuff like Ctrl+Click/F12 randomly stop working. Additionally hot reload randomly stops working and sometimes even watching values. I am observing this behavior across multiple computers and VS installations. According to the task manager Roslyn Code Analysis is taking a lot of CPU. My understanding is that it runs everytime I make a change (hence hot reloading breaking, maybe?) but I'm not sure how to deal with this, how to profile it and so forth. Are there any obvious gotchas I'm missing here?
10 replies
CC#
Created by Vlad on 6/30/2024 in #help
[Xamarin] [Android] Pass pointer into GLES20.GlBufferSubData
Hey yall, I have the following issue: my function takes in an IntPtr and a size, however GLES20.GlBufferSubData (https://learn.microsoft.com/en-us/dotnet/api/android.opengl.gles20.glbuffersubdata?view=net-android-34.0) takes in a Java.Nio.Buffer. I can't seem to construct a ByteBuffer or anything other out of my pointer to pass it into it. Is there a way to maybe get an NDK version of GlBufferSubData or to fake the buffer somehow?
2 replies
CC#
Created by Vlad on 4/21/2024 in #help
Initialize COM object in .Net 8 when using the new GeneratedComInterface and NativeAOT
Hey everyone, I'm trying to NativeAOT my app that uses COM for interaction with WasAPI. I've converted all my code to use the new .Net 8 GeneratedComInterface code generation feature, but I've reached a wall. I need to initialize a COM object of a particular type ("BCDE0395-E52F-467C-8E3D-C4579291692E") which inherits the interface ("A95664D2-9614-4F35-A746-DE8DB63617E6"). Previous I did this by just specifying the class, doing new() and casting it to the interface - which worked despite the class not inheritting the interface on the C# side. Now with GeneratedComInterface and GeneratedComClass it requires me to pair them together, but I don't have the implementation - I just want to consume the object. What is the right way to declare the class initialize the object?
8 replies
CC#
Created by Vlad on 4/2/2024 in #help
Feeding Random into itself - does it "corrupt the randomness"?
If I am to reinitialize an instance of System.Random after every .NextDouble() using the return value as a seed, would that make the randomness worse in some way? I want to do this in order to be able to persist and unpersist a System.Random, via knowing the seed at every step of the way.
61 replies