clr

Sql Server CLR load assembly failed

风流意气都作罢 提交于 2019-12-18 13:11:31
问题 I am trying to deploy an CLR TVF (table value function). In the code I am using JavaScriptSerializer to parse some JSON string, so I reference the System.Web.Extensions dll and my problems start there. Project builds fine, but when I try to register the dll I receive the following error: Assembly 'my_assembly_name' references assembly 'system.web.extensions, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35.', which is not present in the current database. SQL Server attempted

Good samples of using Finalizers in C#

别说谁变了你拦得住时间么 提交于 2019-12-18 13:09:21
问题 When I read a few articles about memory management in C#, I was confused by Finalizer methods. There are so many complicated rules which related with them. For instance, nobody knows when the finalizers will be called, they called even if code in ctor throws, CLR doesn't guarantee that all finalizers be called when programs shutdowt, etc. For what finalizers can be used in real life? The only one example which I found was program which beeps when GC starts. Do you use Finalizers in your code

Fault injection for .NET apps?

随声附和 提交于 2019-12-18 12:55:18
问题 I am wondering if anyone knows of tools or techniques to automatically inject common faults into a running .NET program. Stuff like... Randomly inject an OutOfMemoryException upon allocation Randomly inject FileNotFoundException upon trying to access a files Randomly inject IO or Network exceptions upon using a socket. So I'm really looking for a way to intercept some specific calls in the CLR similar to what AppVerifier does for native Win32 code. The purpose is to test apps under lots of

How to schedule jobs without overlap using LINQ to Objects?

霸气de小男生 提交于 2019-12-18 12:45:12
问题 This is another resource-allocation problem. My goal is to run a query to assign the top-priority job for any time-slot to one of two CPU cores (just an example, so let's assume no interrupts or multi-tasking). Note: this is similar to my earlier post about partitioning, but focuses on overlapping times and assigning multiple items, not just the top-priority item. Here is our object: public class Job { public int Id; public int Priority; public DateTime Begin; public DateTime End; } The real

Switching off the .net JIT compiler optimisations

只谈情不闲聊 提交于 2019-12-18 11:44:45
问题 When we remote a method (that is using generics) the remoting sink cannot seem to discover our method from the other identical named ones. Debugging with .net source code attached I've got it to where there is a MethodInfo.MakeGenericMethod call. However I cannot look at any of the surrounding data as its been jit optimised. I couple of weeks ago I came across a registry setting that would disable this setting (it specifically mentioned that it aid debugging with the source). However being a

SQL Server: How to check if CLR is enabled?

有些话、适合烂在心里 提交于 2019-12-18 11:14:34
问题 SQL Server 2008 - What is an easy way to check if clr is enabled? 回答1: SELECT * FROM sys.configurations WHERE name = 'clr enabled' 回答2: Check the config_value in the results of sp_configure You can enable CLR by running the following: sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'clr enabled', 1; GO RECONFIGURE; GO MSDN Article on enabling CLR MSDN Article on sp_configure 回答3: The accepted answer needs a little clarification. The row will be there if CLR is enabled

Why does null exist in .NET?

无人久伴 提交于 2019-12-18 10:47:12
问题 Why can values be null in .NET? Is this superior to having a guarantee where everything would have a value and nothing call be null? Anyone knows what each of these methodologies are called? Either way, I am not very knowledgeable on this, but wouldn't having a value for everything makes things easier, in terms of simplicity, i.e. eliminating null checks, and being able to write more streamlined algorithms that doesn't have to branch out for checks. What are the pros and cons of each style in

Does the .NET CLR Really Optimize for the Current Processor

删除回忆录丶 提交于 2019-12-18 10:13:43
问题 When I read about the performance of JITted languages like C# or Java, authors usually say that they should/could theoretically outperform many native-compiled applications. The theory being that native applications are usually just compiled for a processor family (like x86), so the compiler cannot make certain optimizations as they may not truly be optimizations on all processors. On the other hand, the CLR can make processor-specific optimizations during the JIT process. Does anyone know if

Using boost in CLR

蹲街弑〆低调 提交于 2019-12-18 09:35:19
问题 I have problem like this, but answer did not help. I have some classes in h and cpp files(which uses boost), and main cpp file. Main cpp include these h files. I include this in main cpp(like in the answer): namespace boost { struct thread::dummy {}; namespace detail { namespace win32 { struct _SECURITY_ATTRIBUTES: public ::_SECURITY_ATTRIBUTES {}; }; }; }; And got rid of this: Warning 1 warning LNK4248: unresolved typeref token (0100001F) for 'boost.detail.win32._SECURITY_ATTRIBUTES'; image

LNK2022 Error When Using /clr

北城余情 提交于 2019-12-18 07:45:14
问题 I'm having a problem linking a C++ project in VS2008 when using the /clr compile option. I am getting the following build errors: Class1.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046f). Class1.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEW): (0x02000473). Class2.obj : error LNK2022: metadata operation failed (8013118D