clr

What could prevent a traceback from being garbage collected?

别来无恙 提交于 2019-12-11 07:39:17
问题 I can't show much code, but see this sample: class Product(metaclass=abc.ABCMeta): __attributes__ = [] __special_attributes__ = [] __json_additional_attributes__ = [] def __init__(self, original_object): for attribute in [c_attr for c_attr in self.__attributes__ if c_attr not in self.__special_attributes__]: try: if hasattr(original_object, attribute): # ... elif original_object.IsAttributeUsed(attribute): # RAISES HERE - this is a clr binding # ... except Exception as err: print('cant

Net Runtime Bug : .NET Runtime 2.0 Error - Event Id: 1000 Crashed my program. What caused this?

别等时光非礼了梦想. 提交于 2019-12-11 07:11:29
问题 I have a new program which has been running 24/7 for over 2 weeks now but last night it crash/went down with no Fatal log exception in my log4net file ...the process appears to have been killed by someting .... and when I looked in the Windows Event Viewer Application log it contained an error for the programs process saying '.NET Runtime 2.0 Error' Type: Error EventID: 1000. This appears to be a .Net runtime failure/bug and has nothing to do with my code. Does anyone know what caused this?

Trouble trying to find the asymptotic runtime of a recurrence

独自空忆成欢 提交于 2019-12-11 06:42:43
问题 I'm trying to figure out the runtime of an algorithm. It is a sort which works by dividing the problem up into sets of 2/3's (it's the CLR sort). I'm having some trouble coming up with it, this is what I have: T(n)=3T([2n]/3)+1 (the 1 is because aside from the recursive calls, there is one exchange which may or may not be made. Assuming it is done, it is still only a constant cost.) T(n)=3T([2([2n]/3+1)]/3+1)+1 T(n)=3T([2([2([2n]/3+1)]/3+1)]/3+1)+1 T(n)=3T([2([2([2([2n]/3+1)]/3+1)]/3+1)]/3+1)

Expression Body Differences Between .NET 4 and .NET 4.6.2

核能气质少年 提交于 2019-12-11 06:32:28
问题 My team is in the midst of upgrading an application from targeting .NET 4.0 to 4.6.2. Yes, late to the party(ies), but better late than never. In our application, there is an extension method that returns the MethodInfo of the returned method from an expression. In other words, if we have: public class Foo { public void DoSomething() { } } and then had an expression Expression<Func<Foo, Action>> = f => f.DoSomething; then our extension method would return the MethodInfo of the method

Winforms' resx file referencing 4.0.0.0 works fine despite project targeting CLR 2.0 - Why?

跟風遠走 提交于 2019-12-11 06:16:57
问题 When building this project, shouldn't resgen.exe create code that would target .net 4.0 out of this resx file; and therefore fail when running under CLR 2.0? This is a follow-up question to On a computer with .net 4.0 - Can one test that an application will run on .net 3.5? . 来源: https://stackoverflow.com/questions/23610395/winforms-resx-file-referencing-4-0-0-0-works-fine-despite-project-targeting-clr

When are method attributes evaluated?

ⅰ亾dé卋堺 提交于 2019-12-11 06:09:43
问题 [CustomMethodAttribute] public void MyMethod(string[] args) { // Some implementation } When will CustomMethodAttribute be evaluated and can you do anything to change when this evaluation takes place? Also, care to explain exactly how the compiler manages this trick? 回答1: When will CustomMethodAttribute be evaluated and can you do anything to change when this evaluation takes place? In general, there is no evaluation that takes place. A custom attribute is added to the method as metadata , and

What's the meaning of 'this' in C#?

五迷三道 提交于 2019-12-11 06:08:55
问题 At page.170 of 'CLR via C#': public sealed class Program { public Int32 GetFive() { return 5; } public static void Main() { Program p = null; Int32 x = p.GetFive(); // In C#, NullReferenceException is thrown } } Theoretically, the code above is fine. Sure, the variable p is null, but when calling a nonvirtual method (GetFive), the CLR needs to know just the data type of p, which is Program. If GetFive did get called, the value of the this argument would be null. Since the argument is not used

Efficiency of creating delegate instance inline of LINQ query?

我的未来我决定 提交于 2019-12-11 05:32:43
问题 Following are two examples that do the same thing in different ways. I'm comparing them. Version 1 For the sake of an example, define any method to create and return an ExpandoObject from an XElement based on business logic: var ToExpando = new Func<XElement, ExpandoObject>(xClient => { dynamic o = new ExpandoObject(); o.OnlineDetails = new ExpandoObject(); o.OnlineDetails.Password = xClient.Element(XKey.onlineDetails).Element(XKey.password).Value; o.OnlineDetails.Roles = xClient.Element(XKey

Calling a function from a Win32 .lib project with /clr from a project that is a pure Win32 project, no clr

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 05:24:45
问题 I want to know how do I exactly call a function from ProjectA::ClassA::FuncA() that is a Win32 .lib with /clr from a ProjectB::ClassB::FuncB() that does not have clr support and is a pure Win32 project. Both these projects are under same solution. First, this is what I have tried: 1. Created the ProjectA with the .lib 2. Added the .lib path to ProjectB properties (in Linker:Input:Add.Dependencies) 3. I added the .h for the .lib created by ProjectA in ProjectB 4. Created the object for

Does holding a reference to an object will keep it in memory if the reference will never be used?

安稳与你 提交于 2019-12-11 04:56:12
问题 I have a collection with WeakReferences to object. The object are loaded dynamically during runtime, and can be collected by GC randomly. Occasionally, I need to permanently delete an object, this is done with asynchronous DB command. Meaning - there is a time period between the delete command and the actual commiting of the deletion in the persistency database where the object can be GCed, and then reloaded from the DB. The easiest way for me to solve this would be to have a 'Deleted' flag