Все вопросы: [clr]

333 вопросов

1
голосов
3ответов
2231 просмотров

CLR Regex for fractions

I need a CLR Regex for fractions or whole numbers and fractions where 1/2 is correct 12 2/3 is correct too and a minus sign can popup just before any number. I first came up with -?([0-9]* )?-?[0-9]+\/-?[0-9]+ but that seems to allow 2/7 12 too for example.

4
голосов
3ответов
2867 просмотров

C# CLR Stored Proc won't Deploy to SQL Server 2005

I'm developing a C# SQL Server 2005 stored procedure that does data validation for my application. I have a nice framework built, that is working. The validation methods are along the lines of: private void TestDate() { TestFields(delegate (string value) { if (value == String.Empty...

10
голосов
2ответов
11093 просмотров

Visual Studio 2010: Embed Interop Types

I found some information about this on Scott Hanselmans Blog Does anybody exactly know what this mean? Is this only for the Office Primary Interop Assemblies, or can I also use this to Embed my Redemption library or other COM libraries?

4
голосов
1ответов
236 просмотров

Different approaches to dynamic typing in the CLR and JVM

.NET 4.0 introduces new support for dispatching invocations on dynamically typed objects. As far as I can make out, this involves: no change to the CLR new types in the BCL new compilers that convert new syntax into usages of the new types In the Java space, folks are discussing adding a new...

332
голосов
10ответов
30952 просмотров

Performance surprise with "as" and nullable types

I'm just revising chapter 4 of C# in Depth which deals with nullable types, and I'm adding a section about using the "as" operator, which allows you to write: object o = ...; int? x = o as int?; if (x.HasValue) { ... // Use x.Value in here } I thought this was really neat, and that it coul...

52
голосов
7ответов
23438 просмотров

Is the CLR a virtual machine?

I read a book which referred to the .net CLR as a virtual machine? Can anyone justify this? What is the reason we need the concept of virtual machines on some development platforms? Isn't it possible to develop a native framework [one without virtual machine] that is fully object oriented and as...

3
голосов
3ответов
2738 просмотров

ignore case with regular expression

I have created a CLR in a SQL server 2005 database. It is a simple regular expression user defined function that will check if a pattern exists in the string I pass into the function. The dot net code I use in the CLR is shown below: Return System.Text.RegularExpressions.Regex.IsMatch("Input",...

18
голосов
7ответов
9161 просмотров

Initialization of instance fields vs. local variables

I have always been wondering about why in the following example it is OK to not initialize the instance field (relying that it will have its default value) and accessing it, while local variables apparently must be initialized, even if I initialize it to default value it would get anyway... pu...

2
голосов
7ответов
1868 просмотров

Can you run C# Code from c++?

Can you run C# code from c++? and How?

2
голосов
4ответов
474 просмотров

Protect IL from Reverse Engineering

How can i protect my IL from reverse engineering ? Any Obsfuscator tool is available ? will it offer maximum security ?

1
голосов
1ответов
292 просмотров

Difference in rounding in sql and clr

I have searched and can not find the answer. I double checked the data types between SQL and CLR and I appear to have that correct. But I am getting a different result between using CLR and SQL. Not much, but enough to be off a penny. And that is not acceptable. Example in VB.NET Dim dLoa...

2
голосов
1ответов
121 просмотров

HyperTalk-like language for use with the CLR

I was always a big fan of HyperTalk back in the days of Stacks in HyperCard. Are there any HyperTalk-like languages available for use with Visual Studio and the CLR? The benefits of using natural language syntax (e.g. Get the third line of text in the textbox named Comments) and strong-typing w...

58
голосов
4ответов
23548 просмотров

Force x86 CLR on an 'Any CPU' .NET assembly

In .NET, the 'Platform Target: Any CPU' compiler option allows a .NET assembly to run as 64 bit on a x64 machine, and 32 bit on an x86 machine. It is also possible to force an assembly to run as x86 on an x64 machine using the 'Platform Target: x86' compiler option. Is it possible to run an asse...

2
голосов
4ответов
522 просмотров

Can a referenced DLL be loaded even if it's not called?

Env.: .NET / VS2008 Hi All, My app uses a 3rd party DLL assembly separately installed on some systems (clearly identified) but not all of them. Which means that on some systems, the DLL is not there hence must not be called. To solve this, I have 2 versions of the app (using 2 configurations)...

4
голосов
3ответов
2747 просмотров

Assembly binding under a WindowsImpersonationContext. How to prevent FileLoadException?

I have an application that needs to do a lot of impersonation, due to moving and creating many files across protected network shares. I've created a simple static class that has a method takes a user, domain, password and a delegate that contains code you need run under the impersonation context...

4
голосов
2ответов
2079 просмотров

Configuring Remote Database Connection Strings within SQL CLR Assemblies

I'm writing a SQL CLR assembly that will be deployed to a third-party database server, but which needs to execute stored procedures residing in my database server. All the pieces are in place, but I don't know how to make the connection string configurable. Articles such as this: http://msdn.micr...

0
голосов
4ответов
181 просмотров

How small do methods have to be for them to be inlined in the main method?

If I create a dll called xaisoft.dll like this: Using System; Using System.Reflection; [assembly:AssemblyVersion("1.0.0.0")] public class XaiSoft { public string PrintName() { return "XaiSoft"; } } and then compile it with csc /t:library lib.cs and then create a process...

0
голосов
2ответов
438 просмотров

ASP.NET - context-agile object,Data sharing concept in application domain?

I read some articles about Application Domain.The deep reading finally resulted in whirling confusion.So I submit the questions to subject experts. 1) As CLR takes care of creating AppDomain as and when needed,could there be a critical need to go for manual Application Domain Creation ? 2)I...

227
голосов
16ответов
30450 просмотров

A definitive guide to API-breaking changes in .NET

I would like to gather as much information as possible regarding API versioning in .NET/CLR, and specifically how API changes do or do not break client applications. First, let's define some terms: API change - a change in the publicly visible definition of a type, including any of its public me...

1
голосов
2ответов
2012 просмотров

Return a recordset from a SQL CLR Assembly?

Guys lease help me out I think I'm close, but I'm missing something. Background I'm rewriting a SQL CLR assembly (stored procedure), my assembly contacts another resource and gets back XML. I want to return this XML as a recordset, NOT a scalar value. From what I've seen, this is how to return...

1
голосов
3ответов
6522 просмотров

SQL Server CLR Stored Procedure JSON Parameter

I've come across a scenario where I want to pass a large amount of data to a Stored Procedure for generating some dynamic SQL. The data I want to pass is stored in this Json/C# class object that I use in my ASP.NET MVC web project. [ { "code":"ABC123", "Count": "12998", "Params": [ ...

2
голосов
4ответов
1416 просмотров

Why is Dispose being called?

In my application, I'm seeing that at times the Dispose method on my main form gets called for apparently no reason. I'm not closing the app through the UI, I'm not sending a close windows message or calling Close() anywhere, however the Dispose method still gets called. Here is the call stack: ...

3
голосов
8ответов
976 просмотров

Reflection of code

Is it possible to use reflection to know what the code is doing, not the types and methods, but rather what is inside the method (if statements, assignment and so on). I know I can disassemble it, but I need to analyze a class at runtime using C#, for example find out how many if conditions there...

2
голосов
1ответов
1565 просмотров

OleInitialize fails when Common Lanuage Runtime is enabled?

I am working on a wxWidgets console application that I want to call into = a C# DLL from, via the CLR. Unfortunately, the application hiccups in the wxWidgets application initialization code because OleInitialize is failing. The error I'm seeing is a pop-up simply stating "Cannot initialize OLE...

23
голосов
5ответов
10919 просмотров

Boxing / Unboxing Nullable Types - Why this implementation?

Extract from CLR via C# on Boxing / Unboxing value types ... On Boxing: If the nullable instance is not null, the CLR takes the value out of the nullable instance and boxes it. In other words a Nullable with a value of 5 is boxed into a boxed-Int32 with a value of 5. On Unboxing: Unboxing is s...

5
голосов
2ответов
420 просмотров

Does the C# Compiler supply a default constructor for reference types (if one not specified) or does the CLR?

I believe (correct me if i am wrong), according to the C# rule for value types, there is no default constructor. The CLR will define the one for zeroing out the field values. For reference type : class Test { private string Name; } Will the default constructor be supplied by C# or the CLR?

2
голосов
3ответов
342 просмотров

Hidden Boxing in the BCL?

Recently I became aware that there are some parts in the BCL that still use some "legacy" code that was probably written before generics were introduced in v2.0 of the framework. Apparently, parts of that "legacy" code may cause the CLR to perform numerous boxing/unboxing operations. Since exces...

0
голосов
2ответов
376 просмотров

How can I tell when a managed thread has changed user contexts using impersonation?

Is there a way to find out when a managed thread has changed user contexts due to impersonation? I'd like to be able to do this from unmanaged code that is observing the managed code using Microsoft's .NET Profiling APIs. For example some managed code may be running in user context A, and then i...

17
голосов
5ответов
10021 просмотров

Table-Valued Parameters to CLR Procedures in SQL Server 2008 - possible?

This page from SQL Server 2008 BOL, talks about CLR Stored Procedures and has a section labelled, "Table-Valued Parameters", which talks about how they can be advantageous. That's great - I'd love to use TVPs in my CLR procs, but unfortunately this seems to be the only reference in the universe t...

5
голосов
1ответов
265 просмотров

When does the .NET CLR evaluate security attributes?

I've just read the following in the CLI specification regarding SecurityExceptions upon method calls: The security check can occur when the CIL is converted to native code rather than at runtime. How does Microsoft's implementation handle this? If, for example, only a certain usergroup is al...