Practical Limitations With Assemblies Not Marked As CLS Compliant?

Mar 21, 2012

As an OSS library author, I've always tried to make my stuff CLS compliant. But MS doesn't make this easy. They often put you in catch-22 situations, such as the following:You cannot have a protected variable differing only in case from the public property.You cannot have protected or public variables starting in an underscore or 'm_'. If you want to make a class really extensible, you often need to have protected variables matching public properties. Your least ugly exit is to add a suffix to the variable, like "Var" or "Value". That's nasty and unacceptable to me. I like clean code.I know of no .NET languages that don't support variables starting in an underscore, and I've used them in many places where the variable needs to be visible to subclasses.

I'm tired of the warnings, and I'm planning on turning off CLS compliance at the assembly level on my 30+ C# libraries.Are there any actual problems with turning off CLS compliance on libraries? Any real problems with doing this? Microsoft has issued unheedable guidance on software for decades, with less that 5% of it being worth the bytes it was encoded in. I can't find any evidence that this best practice has any real effect on anything. But, to be careful, I'm checking. And no, this is not a duplicate of the inverse of this question: Any reason not to mark a DLL as CLSCompliant?I'm looking for actual results and effects here, not the advice of a MS intern. For example, if IronPython, IronRuby, or F# are unable to read or write a variable starting with an underscore, that's an effect, although it would only cause a problem for users subclassing certain objects. If a language or tool is completely unable to use an assembly unless it is marked CLS compliant, now that's a big deal.

View 2 Replies


ADVERTISEMENT

.net - EventArgs(Of T) Gets Marked As Not CLS-Compliant?

Feb 17, 2010

I wrote a generic EventArgs class in my VB.NET solution:

Public Class EventArgs(Of T)
Inherits EventArgs
Private _eventData As T

[code].....

When I use it as in the following example, it says that e is not CLS-compliant.

Event MarketModeChanged(ByVal sender As Object, ByVal e As EventArgs(Of Integer))

View 2 Replies

Practical Difference Between Overriding And Shadowing A Function

Apr 4, 2011

Shadows vs. Overrides in VB.Net.What's the difference between shadowing a function in a base class in a subclass and overriding the same function? There is performance issues involved too?I know how to shadow and how to override in VB.net. My question is about when and why should I shadow a function instead override it and vice-versa.

View 2 Replies

Why Is Function Not CLS-compliant

Aug 15, 2011

I'm getting the following warning message... Return type of function 'ConnectionNew' is not CLS-compliant.

...for this function:
Public Function ConnectionNew(ByVal DataBaseName As String) As MySqlConnection
Dim connection As MySqlConnection = Nothing

[code].....

View 1 Replies

C# - Webbrowser Control Limitations?

Sep 30, 2009

I am using the WebBrowser control in a windows form C# project and wanted to know if there are any limitations of how many instances of such application you can have running at the same time. (in other words does MSFT enforce any limitations other than physical machine limits - CPU/memory etc)

View 3 Replies

Communications :: Limitations Of A Tcp /udp Server

May 27, 2010

For my next project i'll have to create a TCP or UDP server based application. I know how to program a server but i am interested on the limitations of such servers.

how many connections a server may be able to handle at the same time. I suspect that this limitation is based on the type of transfer and how much data or how often it is send to the server.

I also read somewhere that a windows program is limited to 25 threads (connections) per core so if i would have a quad core i can have a maximum of 99 connections granted that the server itself is also a thread. Is that correct?

If the above is correct i wonder how to handle let's say 200 users at the same time. There must be some form / way to handle bigger request loads.

View 3 Replies

LINQ To SQL Classes Not CLS-Compliant?

Aug 5, 2009

I'm using LINQ to SQL as my data access layer for a new project.I have added my database tables to the designer and all is well.Whenever I use one of these classes in a function, Visual Studio warns me that 'Type xxxx is not CLS-compliant' or that 'Return type of function xxxx is not CLS-compliant' Is this a problem with the classes that LINQ to SQL generates? Does it matters? Can I disable these warnings anywhere? My VS error list is clogged up with these warnings making it hard to see anything else.

View 4 Replies

Return Value From PumpState Is No Cls-compliant

Jun 2, 2010

I have the following property defined. MyLibrary.PumpSignal is an enum as follows:

Public Enum PumpSignal As Integer
PumpOff = 0
PumpOn = 1
End Enum

[Code].....

.NET keeps complaining that the Return value from PumpState is no cls-compliant.

View 1 Replies

Using Express Edition Limitations?

Jun 23, 2009

I want to use the free express edition but am concerned about limitations. Wikepedia mentions "Limited options for debugging and breakpoints" as one limitation. None of of the other limitations mentioned concerned me.

View 2 Replies

Limitations Of Excel Resize Method

Jul 9, 2010

I am loading a considerable amount of data from SQL into Excel. For specific reasons, I need to use the Resize method with an array when loading data to Excel.I have found a condition where the size of a cell/row causes the Resize method to crash. I have not found any doco anywhere that shows a Resize limit. My array is OK. My code is OK. But, the data for one row is very large - one field that I am trying to load to a cell has 1097 characters. I have breakpointed the code to assure that this one is the culprit.[code]Does anyone know of any size limits when using Resize. The total number of bytes being written to the row is 1402.Anyone know limits on length for Resize or "overrides" to handle this?

View 1 Replies

Return Type Of Parameter Is Not CLS-compliant

Jun 28, 2010

I have a base class with a static function that returns a typed dataset. I have several classes that inherit the base class with a non-static function that returns the same typed dataset. On these methods I get the 'Return type of parameter yadda
is not CLS-compliant' I don't understand where this is coming from. I have non unsigned integers/etc. in this dataset.

View 2 Replies

C# - Understanding Floating Point Limitations In Calculations

Jan 12, 2011

How to determine when floating point limitations will cause errors in your calculations. For example the following code.
CalculateTotalTax = function (TaxRate, TaxFreePrice) {
return ((parseFloat(TaxFreePrice) / 100) * parseFloat(TaxRate)).toFixed(4);
};

I have been unable to input any two values that have caused for me an incorrect result for this method. If I remove the toFixed(4) I can infact see where the calculations start to lose accuracy (somewhere around the 6th decimal place). Having said that though, my understanding of floats is that even small numbers can sometimes fail to be represented or have I misunderstood and can 4 decimal places (for example) always be represented accurately.

MSDN explains floats as such... This means they cannot hold an exact representation of any quantity that is not a binary fraction (of the form k / (2 ^ n) where k and n are integers). Now I assume this applies to all floats (inlcuding those used in javascript). How can one determine if any specific method will be vulnerable to errors in floating point operations, at what precision will those errors materialize and what inputs will be required to produce those errors?

View 5 Replies

C# :: Hide Non-CLS Compliant Code From Projects Using Other Languages?

Mar 12, 2011

This question is more out of curiosity than a project requirement or a problem.I have a Non-CLS compliant code in one language (say C#), and I need to use it like that only in my current language (across projects, so making internal is not a choice), and at the same time want to allow other languages (say VB) to be able to call the conflicting implementations without generating compile time error.

For instance,
//C#
public class SecurityService

[code].....

View 3 Replies

Possible To Have A Webresource Output A Url String That's XHTML Compliant?

Apr 2, 2009

is it possible to have a webresource output a url string that's XHTML compliant?For example, a typical webresource.axd reference will be something like:[code]

View 7 Replies

Limitations Of OLEDB Connection When Reading Excel File?

Feb 15, 2012

I have this program that uses OLEDB connection to import excel file to data table then use it in other functions.Now I have this question: What are the possible limitations of OLEDB when it reads the Excel file. The File is on xls format, and I want to know if there is such limitations(for example: It has limitation in reading value on a cell).

View 6 Replies

How To Get Mouse Marked Text

Apr 2, 2011

how do i get the text marked by the mouse (in blue) which hasn't been copied in to a string variable or textbox ?

View 15 Replies

Can Input A ISBN With A Missing Digit Marked By '?'

Feb 11, 2010

I can get it to tell me if the ISBN I entered is valid or not, but there is a second part I need that I keep drawing blanks on. I need to be able to enter an ISBN with a missing digit marked by a "?" in the textbox i am entering the ISBN in. For those who don't know what an ISBN is it...

An ISBN (International Standard Book Number) is a ten digit code which uniquely identifies a book. The first nine digits represent the book and the last digit is used to make sure the ISBN is correct. To verify an ISBN you calculate 10 times the first digit, plus 9 times the second digit, plus 8 times the third ... all the way until you add 1 times the last digit. If the final number leaves no remainder when divided by 11 the code is a valid ISBN.

1.Write a program that reads a ten digit number and validates it.(DONE)

2.Write a program that reads in a valid ISBN with a single missing digit, marked with a ?, and outputs the correct value for the missing digit.(Ehhh....)[code]So i need help making it so i can input a ISBN with a missing digit marked by "?" and output a valid ISBN with missing digit.

View 2 Replies

EntityDataSource Null Update Parameters Not Getting Marked

Feb 24, 2011

I am using an EntityDataSource with a FormView on VB.NET application. The FormView contains an AjaxControlToolKit TabContains with multiple tabs. Due to the fact that each tab is a naming container, Bind doesn't work properly for updating values (as discovered from reading other posts on stackoverflow). I instead have to declare UpdateParameters on my EntityDataSource.

Example markup is as follows:
<asp:FormView ID="fv" runat="server" DataSourceID="eds" DataKeyNames="ID">
<EditItemTemplate>
<asp:TabContainer ID="tc" runat="server">
<asp:TabPanel ID="tp" runat="server" HeaderText="Tab 1">
<ContentTemplate>
[Code].....

This works great, until a customer is edited and their name is set to nothing (assuming in this case, a null name is allowed). The Name UpdateParameter is set to Null but the ObjectStateEntry is not set to modified for Null properties, even if previously the Entity had a value specified. As long as the name is changed to something other than Null, everything is updated correctly. I found a workaround by putting the following code in the Updating event of the EntityDataSource.

Dim ose As ObjectStateEntry = context.ObjectStateManager.GetObjectStateEntry(action)
For Each p As Parameter In eds.UpdateParameters
ose.SetModifiedProperty(p.Name)
Next

This makes sure that each property in the UpdateParameters has its state set to modified. It works, but it seems like a hack and I can see it causing problems down the road. Is there anything else I could do?

View 1 Replies

VS 2008 - The VB Pass For The If Marked By Bold And Don't Execute Them?

Mar 29, 2011

[code]...

Someone can tell me why the VB pass for the if marked by bold and don't execute them????

View 4 Replies

C# - Why Are Many Designer Classes In System.Design Marked As Internal

Aug 28, 2009

I have been developing some components for our products at work, and one of them is based off the flow layout panel.What i would like to do is provide a custom designer for it, but without loosing the features provided by it's default designer (System.Windows.Forms.Design.FlowLayoutPanelDesigner) which is marked as internal.Using Reflector i thought i would just implement it again myself, seeing as it inherits from 'FlowPanelDesigner and that from PanelDesigner` all of which are internal.

Why would these classes be specifically marked as internal? Is it due to them being specifically for Visual Studio use, and thus not 'framework' code?Also, is there an easier option that re-implementing all the functionality?

View 2 Replies

2008 - If > Statement - Does It Matter That Variables Are Marked As Strings Vs Integers

Feb 9, 2009

I have a "if This > That then" statement, that doesn't seem to work, as it triggers regardless that "This" is smaller than "that". Does it matter that these variables are marked as strings vs integers?

View 8 Replies

C# - Calling .FindByType Makes VB6 Error Out - Function Or Interface Marked As Restricted

Oct 19, 2010

Possible Duplicate: Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.

Basically, im just searchign for uPnP devices using the uPNPDeviceFinder classes .FindByType method, .FindByUDN works, but FindByType gives an error:VB6 gives a compile error when I attempt to call the method:

Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.

why i am getting it. I am referencing and using the upnp.dll file as found in yoru system32 directory - when i reference and use this in VS2010 (say, vb.net) it all works and no issues are found, but in VB6, i get the error above.

View 1 Replies

VB2010: Resource Files Are Being Marked In The Error List As Not Valid Win32 Apps

Feb 6, 2010

I have an application that is primarily developed on an x86 machine. I recently checked the app out of TFS onto a Win 7 x64 machine for development. However, every single form level resource file shows up in the error list with an entry like the following:

is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) Line 127, position 5. C:Users...shortened...FormsfrmCustomer.resx Line 127 Column 5

What I find interesting is that my application level resource files aren't showing the same error. Plus, these are just XML files. They aren't applications in any way.

I'm currently working under VB2010 beta 2 on both machines. Obviously, with a bunch of errors, the app won't compile on the x64 machine.

View 3 Replies

How To Assemble Assemblies

Jun 13, 2011

In my .aspx file I have:

<%@ assembly src="extensions.vb" %>
<%@ assembly src="debug.vb" %>

[code].....

View 2 Replies

.net - Stop Asp.net Looking For Assemblies In GAC?

Sep 20, 2011

I have started working on a legacy project (ASP.NET 1.1) which was done in an old machine (which I dont have access to). And I am unaware of the development environment settings used for building this project.

Nonetheless, I am able to build the project and deploy it all well from my machine (I created the full development enviroment locally). In my machine everything works great.But some screens where one of the assembly dlls (third party dlls) are used do crash on any machine other than mine! They probably do net get the proper assembly (with matching version or something), even though when I have put all the assemblies in bin (and used the same files while adding references to the project). .NET runtime probably tries to find them in the GAC of the other computers? Or probably in my system itself it loads from GAC and not from the bin? How could I know all this? The question is it runs perfectly fine on my machine, where the assemblies are at both places - in bin and in GAC.

I am lost what I should do to so that no matter which machine I deploy the project, it should always look in bin only! Also, I dont want to change the code in any way because its a legacy code and has been working all right since ages! Just some settings e.g. maching.config or soemthing?

View 1 Replies

C# - Get Assemblies Without Instantiating Them?

Mar 30, 2012

I am trying to get all assemblies in CurrentDomain using AppDomain.CurrentDomain.GetAssemblies() to write their FullName into a DropDownList, however if I don't instantiate them, they are not seen in returned array from GetAssemblies() in CurrentDomain.They are all added as Reference and in Reference folder of the solution. Only time I can get them from the GetAssemblies() is when I first instantiate them.How to overcome this problem with an easy and more generic way instead of instantiate them everytime when I add new Assembly, etc.Due to company policy, I have to obfuscate some parts of the images: All the assembilies are referenced in Reference folder:

View 3 Replies

Assemblies Not Being Loaded Properly?

Sep 19, 2009

I have a windows forms Application using DCOM to connect to another server in order to retrieve data from a database. The program works perfectly fine on my develeopment box both inside of and outside of the idea.However it throws an exception on my test box: System.Exception.... TYPE_E_CANTLOADLIBRARY. The error happens when accessing a property of on the the public DCOM classes. The property holds an instance of one of the private classes for the DCOM. I've compared the registries and all the relevant entries seem to be the same. When I compared the dumps I noticed that System.Config and System.XML werent loaded on the test machine, even though they are installed and appear to be in the GAC.

[Code]...

View 6 Replies

C# - Compare Compiled .NET Assemblies?

Mar 16, 2009

compare to compile .NET assemblies?

For example I have HelloWorld.dll (1.0.0.0) and HelloWorld.dll (2.0.0.0), and I want to compare differences how can I do this?

I know I can use .NET Reflector and use the Assembly Diff plugin. Are there any other good tools out there to do this?

View 5 Replies

C# - Dynamically Loading .NET Assemblies?

May 25, 2009

I am writing a program and I want the program to support plugins. I created an interface that the program must implement. I am using the following code from my main program to call the plugin:

Dim asm As Assembly = Assembly.LoadFrom(ff.FullName)
' Get the type
Dim myType As System.Type = asm.GetType(asm.GetName.Name + "." + asm.GetName.Name)
' If the type is null then we try again without the root namespace name

[code]....

I set this property from my main program and everything works. Except, after a while, m_PanelObject gets set to Nothing for some odd reason. I'm not setting it to Nothing anywhere in my program and there is no place in the plugin code that sets it to Nothing.

View 1 Replies

C# - Dynamically Loading Assemblies In .NET?

May 24, 2010

We've built a small component which takes an Id, looks up an entry in the database for an assembly/namespace/class, and dynamically loads an instance of the class that we're after. It has been working fine up until now, but when running this code in VS 2010, it's failing.

Private Function AssemblyLoaded(ByVal assemblyFile As String) As Assembly
Dim assemblies() As Assembly = AppDomain.CurrentDomain.GetAssemblies
For Each asmb As Assembly In assemblies

[Code]....

But it feels dirty. Is there a better way of checking if an assembly is already loaded, and handing that back to the caller? Are the issues above specific to .NET 4.0 or Visual Studio 2010? I haven't tried this outside the IDE as it requires fairly significant configuration.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved